DLookup with Date

  • Thread starter Thread starter David
  • Start date Start 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.
 
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\#")
 
Back
Top