DLookUp comparing more than 1 field

A

Allen Browne

Your example should work if EmbID and DesignID are both fields of type
Number.

If DesignID is a Text-type field, you need quotation marks around the value.
The 3rd argument would be:
"[EmbID] = " & [EmbID] & "AND [DesignID] = """ & [Designid]) & """"
 
F

Fishiee

Hi,

Can we retrieve a value from a table to a textbox of a form by comparing
more than one field using DLookUp?
If yes, then what would be the syntax for comparing text fields and number
fields?

I have used following code but does not work:
CONTROLSOURCE= DLookUp("[Price]","DesignerCost","[EmbID] = " & [EmbID] & "
AND [DesignID] = " & [Designid])

however this one works but its not what I wanted as output:
CONTROLSOURCE= DLookUp("[Price]","DesignerCost","[EmbID] = " & [EmbID] )

Pls help,
Thanx in advance,
Sumit
 
F

Fishiee

Hi,
Answer to my own question:
Sorry I made a mistake with second field name but the syntax was right.
Thanx anyway,
Sumit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top