I have an unbound form with an unbound textbox; the type mismatch error hits this code behind a button:
If (DLookup("[Medicaid_ID]", "Returned_Mail", "Medicaid_ID = '" & SrchMed_ID & "'" & _
"And Nz([SuppressDate])")) Then
The Medicaid_ID is entered into the SrchMed_ID unbound textbox and when the button is clicked it should look at the REturned_Mail table to see if there is an existing record if so, take action otherwise do something else.
This code did work when was only entering numerical numbers, but I have now entered charac/numerical combined numbers. Below is the complete code set for the button:
Private Sub Command5_Click()
Dim MedID As String
Dim SuppressDate As Date
' Get Value from Medicaid_ID textbox on the Form:
Me.btnsrch.SetFocus
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_Processing", , , , acFormAdd
Me.SrchMed_ID = ""
Else
If (DLookup("[Medicaid_ID]", "Returned_Mail", "Medicaid_ID = '" & SrchMed_ID & "'" & _
"And Nz([SuppressDate])")) Then
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 = ""
Else
DoCmd.OpenForm "RA_Processing", , , "Returned_Mail.Medicaid_ID = '" & SrchMed_ID & "'"
Me.SrchMed_ID = ""
End If
End If
End Sub
Any help solving this mystery will be greatly appreciated.
Thanks,