DLookUp and Dates

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.
 
R

Rick Brandt

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).
 

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