Run Time Error

jamphan

Registered User.
Local time
Today, 01:04
Joined
Dec 28, 2004
Messages
143
I have the following code linked to an event. when I run this I am getting a run time error that says "Data type mismatch in criteria expression" Any ideas on what could be the problem?

Private Sub Command2_Click()

If IsNull(DLookup("[Acct#]", "qryTest", "[Acct#]=" & Forms![Form]![Account])) = True Then
If IsNull(DLookup("[Acct#]", "qryTest2", "[Acct#]=" & Forms![Form]![Account])) = False Then

DoCmd.OpenQuery "qryTest2", acNormal
Else
MsgBox "The Account Number was not found"
End If
Else
DoCmd.OpenQuery "qryTest", acNormal
End If


End Sub
 
that solved that problem but now I am getting a run time error that says "You cancelled the previous operation" When I debug it goes to the second if statement
 
that solved that problem but now I am getting a run time error that says "You cancelled the previous operation" When I debug it goes to the second if statement
 
Your second IF is redundant.
Remove it.

RV
 

Users who are viewing this thread

Back
Top Bottom