How to return customer orders within a specific date in an access query

In this post I will teach you how to set up an Access query to return customers orders within a specific date range. A query in a relational database is asking your database a question. Let’s say I want to know how many orders were placed in the first quarter of 2012 or how many sales were made in June 2012? Those answers can be found by either setting up a query wizard or by just going straight to the design view of a query. In this post, I am going to go through the query wizard in Access 2010. The first step is to click the Create Tab then click Query Wizard.

Access Query button

Then I pick the Simple Query Wizard and pick the table(s) I want to pull my data from. Then send over the fields you want to display in your query by clicking the arrow right button.

Which fields do you want in your query

Then I passed through the wizard’s default choices until I came to the final step in which I named the query qrySalesByDates and clicked Modify. The only thing waiting for me now is finish.

title for access query

Welcome to the design view.  This where you raise your hand and ask a question if you were a student.🙂 Well actually you ask your question in a written statement on the criteria line.

criteria line for access query

If I want to find all dates between Jan 1, 2012 and March 31, 2012 then I would type the following down in the criteria line: Between 1/1/2012 And 3/31/2012. Access would then automatically place pound signs around both dates. A little trick to type in a bigger box is to right click the criteria line and choose Zoom or the shortcut Shift+F2. Click Access keyboard shortcuts for my downloadable guide.

Save the query and run it by clicking the run button which is on the Query Tools Design tab if you are in the design view.

All dates within my question query show up as follows just as I had asked for.

1st quarter 2012 results

A great way to not hard code this query and give it some flex muscles is to write a parameter query. Maybe you want the user to put the start date and end date each time they run the query but the dates will be different every time they want to run it. Then all you have to do is type the following in the criteria line. Between [enter start date] And [enter end date]. Place the script prompt for the user in square brackets.

parameter query

After running the query and typing the following I get these different answers based on user input at the time of running the query. That’s awesome sauce indeed!

enter parameters

Results in:

results of parameter query of June 2012

Good luck with collecting and querying your data. Hope this post helps.

About Steve Chase

I'm a proud husband and dad to 4 boys! Microsoft Certified Trainer and Boy Scout Leader are some of things I call myself. The Cincinnati Reds are my favorite team! When not outdoors, I enjoy working with documents in Microsoft Office, QuickBooks, Visio and Photoshop. My wife, Erin, shares her awesome recipes on her blog at
This entry was posted in Access and tagged , . Bookmark the permalink.

3 Responses to How to return customer orders within a specific date in an access query

  1. Pingback: Make the Parameter Values Show Up in an Access Report | Steve Chase Docs

  2. Marisol says:

    Steve Thanks for the tip, is it possible to do the same procedure on other categories other than date? For example a company name or task manager?

  3. Steve Chase says:

    Yes, you can do parameter prompts for any field. For example, if you wanted to lookup the company name you would add [enter the company name] in the criteria for that field. Whatever is typed much match the spelling exactly. A trick is to use wildcards so that you can type a keyword.
    This is how you would do that. Enter in the criteria Like “*” & [enter keyword] & “*”. Use the ampersand characters with * in quotes include multiply characters on either side of the keyword typed.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s