Problem with DLookup function

J

John S. Ford, MD

What's the matter with this line of code:

varX = Not (DLookup("[PatientMRNumber]", "qryDATA_Patients",
"[PatientMRNumber]=" & txtMRNumber))

[PatientMRNumber] is a text field. varX is type Variant. txtMRNumber is a
TextBox control for which people type a number.

The code triggers the following error: "Data type mismatch in criteria
expression." If I substitute CStr(txtMRNumber) for txtMRNumber, I still get
the same error.

Any ideas as to what I'm doing wrong?

John
 
Top