I'm having problems with the Find button I created. When I enter a Project # to search for, the error message comes up, even if I enter a valid project #. Any suggestions on what I'm doing wrong, or if there's a better way to handle this situation? Here's my code:
Private Sub cmdFindRecord_Click()
On Error GoTo Err_cmdFindRecord_Click
Dim strLen As Integer
Dim VariableName As String
strLen = Len(VariableName)
DoCmd.GoToControl "txtProjectID"
VariableName = InputBox("Enter the project number to search for.", "Project Search"
DoCmd.FindRecord VariableName, acAnywhere, , acSearchAll, , acCurrent, True
Exit_cmdFindRecord_Click:
Exit Sub
Err_cmdFindRecord_Click:
MsgBox "A project number must be entered."
Resume Exit_cmdFindRecord_Click
End Sub
Thanks!
Ryan
Private Sub cmdFindRecord_Click()
On Error GoTo Err_cmdFindRecord_Click
Dim strLen As Integer
Dim VariableName As String
strLen = Len(VariableName)
DoCmd.GoToControl "txtProjectID"
VariableName = InputBox("Enter the project number to search for.", "Project Search"
DoCmd.FindRecord VariableName, acAnywhere, , acSearchAll, , acCurrent, True
Exit_cmdFindRecord_Click:
Exit Sub
Err_cmdFindRecord_Click:
MsgBox "A project number must be entered."
Resume Exit_cmdFindRecord_Click
End Sub
Thanks!
Ryan