DLookup with Date

D

David

I am trying to use some code to open a report and cannot
remember the correct syntax for using a date with DLookup
when you are getting the date from a control on a form.

DLookup("CarNo","qry_Rail","[RelDate] = #Me.SwitchDate#")

What am I doing wrong?

Thanks for your help in advance.
 
A

Allen Browne

Concatenate the date into the 3rd argument.

You may also want to explicitly format the date:
= DLookup("CarNo","qry_Rail",
"[RelDate] = " & Format([SwitchDate], "\#mm\/dd\/yyyy\#")
 

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