Find date

  • Thread starter Thread starter Jason
  • Start date Start 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.
 
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") & "#"
 
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!
 
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.
 
Back
Top