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