serenitylai
03-12-2017, 03:57 AM
Here's suppose to happen when the employee clicks on the search button based on the employee number the name of the employee will show on the Textbox2 and by clicking the LOGIN Button the timestamp will appear on the spreadsheet on that date as shown on the second picture. I have finished the code on the first button which is the Search button. here's the code as well:
Private Sub Search_Click()
On Error GoTo MyErrorHandler:
Dim empnum As Long
Dim name As String
empnum = TextBox1.Text
name = Application.WorksheetFunction.VLookup(empnum, Sheet2.Range("A3:B9"), 2, False)
TextBox2.Text = name
MyErrorHandler:
If Err.Number = 1004 Then
MsgBox "Employee Not Present in the table."
End If
If Err.Number = 13 Then
MsgBox "please put employee number"
End Sub
18603
18605
Private Sub Search_Click()
On Error GoTo MyErrorHandler:
Dim empnum As Long
Dim name As String
empnum = TextBox1.Text
name = Application.WorksheetFunction.VLookup(empnum, Sheet2.Range("A3:B9"), 2, False)
TextBox2.Text = name
MyErrorHandler:
If Err.Number = 1004 Then
MsgBox "Employee Not Present in the table."
End If
If Err.Number = 13 Then
MsgBox "please put employee number"
End Sub
18603
18605