DLookup function - search criteria x 2 (1 Viewer)

adamnorsworthy

Registered User.
Local time
Today, 01:37
Joined
Nov 9, 2005
Messages
13
Hey there,

I would like to find a value from a record, and I am using the DLookup function. To find the right record I need to provide two references, the customer id and the booking id. I have tried to use 'And' such as:

dateineed = DLookup("[Arrival date]", "detbooking", "[BookingID]= " & refe.Value And "[CustomerID]= " & customer.Value)

with no luck. How can I get access the correct record in a record set when I can only specify the exact record if I have use two references?

Kind regards, Adam.
 

petehilljnr

Registered User.
Local time
Yesterday, 17:37
Joined
Feb 13, 2007
Messages
192
Because the criteria is a string, you have to include the AND inside the quotes:

e.g.

dateineed = DLookup("[Arrival date]", "detbooking", "[BookingID]= " & refe.Value & " And [CustomerID]= " & customer.Value)

Regards,
Pete
 

Users who are viewing this thread

Top Bottom