Dlookup Query Expression

G

Guest

Hi Everyone

I have the following expression in a field I add in the design view of a
query.

Basically I have a table of Contacts named "Contacts" with fields:
Contact Types : GM, Owner or Owner's Rep so it's text
Hotel: name of the hotel so text again, note that each contact is related to
an hotel
E-mail: e-mail address of the person

In a Query I import all the fields and add one called GMEmailAddress:

For the field E-Mail, I have add a criteria : Is Null

This query is then supposed to give me the list of Owners without e-mail
addresses and the e-mail address of the GM of their hotel

The following script doesn't work !!!!

GmEmailAddress: DLookUp("[Contacts]!","[Contacts]","
[Contacts]![Hotel]='" & [Hotel] & "' And [Contacts]![Contact Type]="GM")

I know that it we have to use ' or " depending of the nature of the field
but I think Ihave been carefull.

I receive a message Syntax error Wrong Operand

Anybody can help me on this,

Would be really greatfull!
 
S

Steve Schapel

Paul,

Well, the syntax of the expression is not quite correct. Try it like
this...
GmEmailAddress: DLookUp("","Contacts","[Hotel]='" & [Hotel] &
"' And [Contact Type]='GM'")

According to your description, it looks to me like you also need a
criteria of "Owner" in the Contact Type column of the query.
 

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

Similar Threads

DLOOK UP in Query Criteria 1
DLookup and Nz 0
Query 1
If then Else statement to pull a query 2
D Lookup with Multiple Criteria 1
Karma for O'Leary 3
Macro not working right 1
cant reply all 2

Top