Using DLookUp to see if a row exists

robherms

Registered User.
Local time
Today, 09:16
Joined
Aug 18, 2006
Messages
15
I am having a problem with the DLookUp function. I am using this function to pull a field from a table into a variable, but first I would like to check to make sure that the data I am looking for is in the table. I am doing this by evaluating the return value of DLookUp via an If statement. Here is a smple of my code
Code:
If (DLookup("[Client Name]", "[Apps for CB]", "[Acap No] =" & Int(strAcaps))) Then strName = DLookup("Client Name", "Apps for CB", "LoanID='" & strAcaps & "'")

I am getting the following error: Type Mismatch

Acap No is a 19 digit number that is stored in the table as a number. Should I concided storing it in the table as s string? Thank you in advance for all your help!!
 
Try:
Code:
If Not IsNull(DLookup("[Client Name]", "[Apps for CB]", "[Acap No] =" & strAcaps)) Then...
 
Thanks a lot! It works fine now.:D
 

Users who are viewing this thread

Back
Top Bottom