I have a routine that looks for badge numbers out of different files.
If a badge number isn't listed in the file I want the end user to be
able to type the number, employees name and department. How would I do
this? The code is listed below:
Private Sub intBadge_AfterUpdate()
If IsNumeric(intBadge) Then
txtEEName.Text = Application.VLookup(Val(intBadge), _
Workbooks("Supplies.CSV").Worksheets("Supplies").Range("A:D"),
2, 0)
txtDept.Text = Application.VLookup(Val(intBadge), _
Workbooks("Supplies.CSV").Worksheets("Supplies").Range("A:D"), 3, 0)
txtSSN.Text = Application.VLookup(Val(intBadge), _
Workbooks("Supplies.CSV").Worksheets("Supplies").Range("A:D"), 4, 0)
intQTY1 = "1"
txtBarCode1.SetFocus
Else
txtEEName.Text = Application.VLookup(intBadge, _
Workbooks("Salary
Employees.xls").Worksheets(1).Range("A:C"), 2, 0)
txtDept.Text = Application.VLookup(intBadge, _
Workbooks("Salary
Employees.xls").Worksheets(1).Range("A:D"), 3, 0)
intQTY1 = "1"
txtBarCode1.SetFocus
End If
addJump:
MsgBox "ID Check! If correct, type Employee's Name",
vbOKOnly, "ID Error"
End Sub