This repository has been archived by the owner on Jan 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inventorylist-source.vb
84 lines (74 loc) · 2.36 KB
/
inventorylist-source.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Private Sub CLOSEBTN_Click()
Unload Me
End Sub
Private Sub Quit_Click()
Application.QUIT
End Sub
Private Sub SAVEBTN_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Inventory List")
'find first empty row in database
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
'check for a tool type
If Trim(Me.TextBoxTOOLTYPE.Value) = "" Then
Me.TextBoxTOOLTYPE.SetFocus
MsgBox "Please enter a tool type" + vbNewLine + "If unknown please write MISC"
Exit Sub
'check for a software version
ElseIf Trim(Me.TextBoxSWVERSION.Value) = "" Then
Me.TextBoxSWVERSION.SetFocus
MsgBox "Please enter software version if unknown please write N/A"
Exit Sub
'check for a part number
ElseIf Trim(Me.TextBoxPARTNUMBER.Value) = "" Then
Me.TextBoxPARTNUMBER.SetFocus
MsgBox "Please enter a part number"
Exit Sub
'check for a media type
ElseIf Trim(Me.TextBoxTAPECD.Value) = "" Then
Me.TextBoxSWVERSION.SetFocus
MsgBox "Please enter what media the software is installed on"
Exit Sub
'check for a software type
ElseIf Trim(Me.TextBoxRELEASEIMAGE.Value) = "" Then
Me.TextBoxRELEASEIMAGE.SetFocus
MsgBox "Please enter what type of software it is" + vbNewLine + "If it is not a RELEASE, IMAGE or PATCH Put MISC ie(Firmware, etc)"
Exit Sub
End If
'copy the data to the database
'use protect and unprotect lines,
' with your password
' if worksheet is protected
With ws
'.Unprotect Password:="password"
.Cells(iRow, 1).Value = UCase(Me.TextBoxTOOLTYPE.Value)
.Cells(iRow, 2).Value = UCase(Me.TextBoxSWVERSION.Value)
.Cells(iRow, 3).Value = UCase(Me.TextBoxDESCRIPTION.Value)
.Cells(iRow, 4).Value = UCase(Me.TextBoxPARTNUMBER.Value)
.Cells(iRow, 5).Value = UCase(Me.TextBoxTAPECD.Value)
.Cells(iRow, 6).Value = UCase(Me.TextBoxRELEASEIMAGE.Value)
.Cells(iRow, 7).Value = UCase(Me.SOFTWARELOCATION.Value)
'.Protect Password:="password"
End With
'clear the data
Me.TextBoxTOOLTYPE.Value = ""
Me.TextBoxSWVERSION.Value = ""
Me.TextBoxDESCRIPTION.Value = ""
Me.TextBoxPARTNUMBER.Value = ""
Me.TextBoxTAPECD.Value = ""
Me.TextBoxRELEASEIMAGE.Value = ""
Me.TextBoxTOOLTYPE.SetFocus
ThisWorkbook.Save
End Sub
Private Sub UserForm_Initialize()
With SOFTWARELOCATION
.AddItem "LOCATION 1"
.AddItem "LOCATION 2"
.AddItem "LOCATION 3"
.AddItem "LOCATION 4"
End With
lbl_Exit:
Exit Sub
End Sub