Criteria On Dlookup

S

Simon

I have the following code for a look up
InvoiceNumber = DLookup("InvoiceNumber", "tblInvoiceNumbersWS",
"OrderNumber = " & Me.OrderNumber)



What i require for this dlookup is two lots of Criteria
OrderNumber = Me.OrderNumber
Type = Me.Type


What is the code for two lots of critia for Dlook up


Thanks

SImon
 
B

Beetle

If Type is a text field then

InvoiceNumber = DLookup("InvoiceNumber", "tblInvoiceNumbersWS",
"OrderNumber = " & Me.OrderNumber & " And Type = """ & Me.Type & """")

If type is a numeric field then

InvoiceNumber = DLookup("InvoiceNumber", "tblInvoiceNumbersWS",
"OrderNumber = " & Me.OrderNumber & " And Type = " & Me.Type)
 

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