DLookUp and Dates

  • Thread starter Thread starter Chaster
  • Start date Start date
C

Chaster

I am having a problem with this working and think it might have something
with the field being a date field?

=DLookUp("[StartDate]","Conventions","[ShowName] = " & [Forms]![Order
Detail]![ShowName] & "")

I will also have to so some look up on time fields also. Would the syntax
for that be different?

Thanks in advance.
 
Chaster said:
I am having a problem with this working and think it might have something
with the field being a date field?

=DLookUp("[StartDate]","Conventions","[ShowName] = " & [Forms]![Order
Detail]![ShowName] & "")

I will also have to so some look up on time fields also. Would the syntax
for that be different?

The type for the field you're "looking up" is not an issue. It is the type for the
field in your WHERE clause that dictates different syntax. Assuming that [ShowName]
is a text field you need to delimit it with single quotes in the expression.

=DLookUp("[StartDate]","Conventions","[ShowName] = ' " & [Forms]![Order
Detail]![ShowName] & " ' ")

In the above expression I placed spaces around the single quotes to make it easier to
distinguish them in this post. You would omit those in your actual expression. If
the field in the WHERE clause were DateTime you would delimit them with #. For
numeric fields in the WHERE clause your original syntax would be fine (no delimiter).
 
Back
Top