Kathy said:
I'm trying to run a report between certain dates. For some reason
when I run them, they do not include the 1st or last date put in. For
instance I run a report between May 1,2007 and May 31, 2007. The
report leaves out May 1st and May 31st.
Missing May 1st is a mystery (my guess being that there actually are no
records dated May 1st), but missing the last date is a common problem when
the dates in the table have non-midnight time components. After all May
31st, 2007 at 10:00 AM is not between May 1st, 2007 and May31st, 2007
because when you don't specify the time midnight is assumed.
The solution is to add an extra day to the end date, but if there migth be
some records that DO have midnight as the time you could get records for
that last date that you don't want. In that case don't use BETWEEN since
that is inclusive. Instead use something like...
WHERE DateField >= #May 1, 2007#
AND DateField < DateAdd("d", 1, #May 31, 2007#)
The above is a weird looking example, but I'm assuming you are getting your
start and end date values from somewhere besides hard-coding them as I did.