Dlookup Query Expression

  • Thread starter Thread starter Guest
  • Start date Start date
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!
 
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

Back
Top