Hello, I have a form that contains an unbound textbox named "Srch_MedID" my code below worked until I tried to search for an ID that contained an alpha. When I try to search lets say 'H445238' I receive the run-time error; if I search '1234567' it finds the record and opens the form. Can you tell me what I am missing?
Private Sub btnsrch_Click()
Dim MedID As String
' Get Value from Medicaid_ID textbox on the Form:
Me.SrchMed_ID.SetFocus
MedID = Me.SrchMed_ID.Text
Dim Msg, Style, Title, Response, MyString
If IsNull(DLookup("[Medicaid_ID]", "Returned_Mail", "Medicaid_ID = '" & SrchMed_ID & "'")) Then
DoCmd.OpenForm "RA_Tracking", , , , acFormAdd
Me.SrchMed_ID = ""
Else
If (DLookup("[Medicaid_ID]", "Returned_Mail", "Medicaid_ID = '" & SrchMed_ID & "'" & _
"And IsNull([SuppressDate])")) Then
DoCmd.OpenForm "RA_Tracking", , , "Returned_Mail.Medicaid_ID = '" & SrchMed_ID & "'"
Me.SrchMed_ID = ""
Else
MsgBox ("Do not log RA's for this Medicaid ID:" & (Chr(13)) & (Chr(13)) & " " & [SrchMed_ID] & (Chr(13)) & (Chr(13)) & "Recycle this providers RA's")
Me.SrchMed_ID = ""
End If
End If
End Sub
Thanks.