tech on the net
Home About Us Feedback Site Map

Microsoft

Access Excel Word

Database

SQL Oracle / PLSQL SQL Server MySQL MariaDB PostgreSQL

Web Development

HTML CSS Color Picker

Language

C Language

More

ASCII Table Linux UNIX Java Clipart Joke of the Moment

Other Sites

CheckYourMath BigActivities DigMinecraft
Share this page:

MS Access: Create a query that accepts "Start" date and "End" date as parameters in Access 2003/XP/2000/97

Question: In Microsoft Access 2003/XP/2000/97, I'm trying to run a query based on a date. When the query opens, I would like some type of window prompting for the user to enter a "start" date and an "end" date. How can I do this?

Answer: You can create a parameter query that prompts for both a "start" date and an "end" date.

To do this, first create your query.

Microsoft Access

Then enter your "start" date and "end" date parameters. Parameters should be enclosed in [] brackets as follows:

>=[Start Date] And <=[End Date]

This will create a parameter called [Start Date] and a parameter called [End Date]. So that only those records from the Orders table will be returned where the OrderDate field is between these two dates.

Next, you probably want to ensure that the user enters a valid date in these two parameters. To do this, select Parameters under the Query menu.

Microsoft Access

When the Query Parameters window appears, enter the two parameters [Start Date] and [End Date], and select Date/Time as the data type. Click on the OK button.

Microsoft Access

Now, when you run the query, you will be prompted to enter the "start" date.

Microsoft Access

Then prompted to enter the "end" date.

Microsoft Access

Your query will then only return the records where the OrderDate is between these two values.