Query by date range

  • Thread starter Thread starter MikeR
  • Start date Start date
M

MikeR

Access 2000, either of these queries returns results dated 3/12 and greater, but
excluding 3/23 and greater. Seems like 3/12 should be excluded also. LDate is a
Date/Time field, and contains both a date and a time.
I can deal with it, but it just seems inconsistant.

Select * from Mast where LDate > #03/12/2005# and LDate < #03/24/2005# order by
LDate;

Select * from Mast where LDate between #03/12/2005# and < #03/24/2005# order by LDate;

Thanks,
MikeR
 
It sounds like you have the non-zero time component in the values of your
Field LDate.

For example, if LDate is #03/12/2005 08:00:00#, the Record will be selected
by your criteria. However, if LDate is #03/24/2005 08:00:00#, the Record
will be excluded by your criteria.

To get the inclusive range for 03/12/2005 (+00:00:00) to 03/24/2005
(+23:39:59), use:

WHERE (LDate >= #03/12/2005#) And (Ldate < #03/25/2005#)

HTH
Van T. Dinh
MVP (Access)
 
Thanks Van -
You are correct that the time portion will be non-zero 99.99999999999% of the
time. I was thinking also that I would have to manipulate one or the other of the
dates, depending on whether I want them inclusive or exclusive.
MikeR
 
Back
Top