Include parameters in the report's underlying query so that when the report
is opened you'll be prompted for the start and end dates:
PARAMETERS
[Start date:] DATETIME,
[End date:] DATETIME;
SELECT *
FROM YourTable
WHERE YourDate >= [Start date:]
AND YourDate < DATEADD("d",1, [End date:]);
A couple of points:
1. Declaring date/time parameters is always as good idea as otherwise a
parameter entered in short date format might be interpreted as an
arithmetical expression and give the wrong result.
2. Defining the end of the date range as before the day after the end date
makes it more bullet-proof as it takes account of the possibility of the
date/time values inadvertently having a non-zero time of day (which could be
there without you seeing if the dates are not formatted to show times of day,
the usual culprit being the inappropriate use of the Now() function to enter
a date). Otherwise any rows with such date/time values during the final day
of the range would not be returned as <= a date means on or before midnight
at the start of the day, there being no such thing in Access as a date value
per se, only specific date/time values. A date entered without a time is
midnight at the start of the day, not the day as a whole. The same applies
if you use a BETWEEN….AND operation to define the date range.
In your case as you are selecting the dates from a calendar control they
should all have zero times of day values, so you'd be on safe ground, but the
above method covers all bases.
Ken Sheridan
Stafford, England