DLookup criteria question

Gkirkup

Registered User.
Local time
Today, 07:46
Joined
Mar 6, 2007
Messages
628
I am struggling with the criteria for the DLookup function. What I need is the criteria to equal [PARTNUMBER] in the query I am accessing with Dlookup, with [MYPARTNUMBER] which is a field in a table being used in the query where I am writing the DLookup.
So something like "[PARTNUMBER] = [MYPARTNUMBER]" but I can't get it to work.

Robert
 
To assist you with DLookup, readers will have to know what Table this field is in.
 
There are 3 types of criteria comparisons: dates, text and numbers. The example you gave works if your field is numeric. If it is text it needs to be escaped with single quotes:

"[MYPARTNUMBER]='" & [PARTNUMBER] & "'"

If it is dates you need to escape the value with pound signs:

"[MYPARTNUMBER]=#" & [PARTNUMBER] & "#"

If that doesn't do it we would need more information. Like jdraw asked for table information as well as how you know its not working--getting an error message/unexpected results/etc.
 

Users who are viewing this thread

Back
Top Bottom