If you want to design your Access queries to prompt a user for one or more dates and then use those date values as the criteria for a query, there are a number of ways to accomplish this mission. The key is understanding how to construct the expression for the Date field's Criteria.

To illustrate, let's consider three cases: querying for all dates earlier than a given date, later than a given date, and between two dates. The first two are almost identical. Open your query in Design view and enter the following for your Date field's Criteria:

<[Enter your date]

When you run this query, the Enter Parameter Value dialog box appears with the prompt "Enter your date." When the user enters a date and clicks OK, Access executes the query and returns records where the date in the table is earlier than the date the user entered.

To query for records stamped later than the user-provided date, enter the following for the Date field's Criteria:

>[Enter your date]

If you want the results to include dates that equal the user-provided

value, use >= or <= as the operators.

The first two queries establish ceilings and floors on date values. To select records that fall between two dates, the criteria for your Date field might look something like this:

Between [Enter your early date] And [Enter your ending date]

When the user runs this query, Access presents two prompts and returns records whose date values fall between the two user-provided dates. By default, the Between...And construct also returns records that match the user-provided values.

Created Date: 03/20/2002  Last Reviewed: 03/20/2002  Rev. Date: