Find date

J

Jason

I have a lookup for current date and next date using findfirst and comparing
with today.
In the forms the dates are displayed as short date (dd/mm/yyy). There are
dates for today but the code is not finding the dates. I've tried using hash
(#) before and after the date but still nothing found.

Thanks,
J.
 
S

Stuart McCall

Jason said:
I have a lookup for current date and next date using findfirst and
comparing with today.
In the forms the dates are displayed as short date (dd/mm/yyy). There are
dates for today but the code is not finding the dates. I've tried using
hash (#) before and after the date but still nothing found.

Thanks,
J.

Access requires searches on dates to be in US format, so try:

rs.FindFirst "MyFieldName = #" & Format("MyDate", "mm/dd/yyyy") & "#"
 
J

Jason

I remember having this problem a lot. When dealing with date comparisons
I've had to use something like clng(DateFld1) comparison clng(DateFld2).
Surely I shouldn't have to do this!
 
J

Jason

I thought access interpreted the date properly when using that layout.
Obvious now that it has to use the us format. I'll probably stick to what I
am using since this coding has already been done.
 

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