DLookup

R

rahdirs

I have a table with fields ID and DESC. Why doesn't DLookup work if i
try to query on the DESC field (second field).

DLookup ("[ID]" ,"tblTest", "[DESC] = " & Me.txtDesc - Does not work
DLookup ("[DESC]" ,"tblTest", "[ID] = " & Me.txtID - Work fine

Any workarounds
 
D

Douglas J. Steele

I'm assuming ID is a numeric field, while DESC is a text field.

When querying on a text field, you must supply quotes around the value:

DLookup ("[ID]" ,"tblTest", "[DESC] = " & Chr$(34) & Me.txtDesc & Chr$(34))
 
Top