CancerStick
Registered User.
- Local time
- Today, 06:46
- Joined
- Mar 13, 2008
- Messages
- 12
I'm trying to build a code that lets the user enter an employee's last name and first name to retrieve the employee's ID. I'm using a lookup form for the application so when the user enters information on a write up or equipment issue, and they need to assign the information to an employee's ID, they can run the application to retrieve the ID.
I've gotten as far as getting a message box to appear and notify the user to enter the proper info. Here's what I've got so far;
Private Sub cmdGetID_Click()
Dim strFullName As String
Dim EmpRef As String
If IsNull(Me![txtFullName]) Or (Me![txtFullName]) = "" Then
MsgBox "Enter Emplyoee Name For ID Request", vbOKOnly, "Invalid Search Criterion!"
Me![txtFullName].SetFocus
Exit Sub
End If
DoCmd.ShowAllRecords
DoCmd.GoToControl ("strEID")
DoCmd.FindRecord Me!txtFullName
strEID.SetFocus
EmpRef = strEID.Text
txtFullName.SetFocus
strFullName = [EmFirstName.txt] & " " & [EmLastName.txt]
If EmpRef = strFullName Then
MsgBox "Match Found For: " & strFullName, , "Congratulations!"
strEID.SetFocus
txtFullName = ""
MsgBox "Match Not Found For: " & strFullName & " - Please Try Again.", , "Invalid Search Criterion!"
txtFullName.SetFocus
End If
End Sub
Help Please!
I've gotten as far as getting a message box to appear and notify the user to enter the proper info. Here's what I've got so far;
Private Sub cmdGetID_Click()
Dim strFullName As String
Dim EmpRef As String
If IsNull(Me![txtFullName]) Or (Me![txtFullName]) = "" Then
MsgBox "Enter Emplyoee Name For ID Request", vbOKOnly, "Invalid Search Criterion!"
Me![txtFullName].SetFocus
Exit Sub
End If
DoCmd.ShowAllRecords
DoCmd.GoToControl ("strEID")
DoCmd.FindRecord Me!txtFullName
strEID.SetFocus
EmpRef = strEID.Text
txtFullName.SetFocus
strFullName = [EmFirstName.txt] & " " & [EmLastName.txt]
If EmpRef = strFullName Then
MsgBox "Match Found For: " & strFullName, , "Congratulations!"
strEID.SetFocus
txtFullName = ""
MsgBox "Match Not Found For: " & strFullName & " - Please Try Again.", , "Invalid Search Criterion!"
txtFullName.SetFocus
End If
End Sub
Help Please!
Last edited: