Access 2007-2016
Access 2000-2003
Access Seminars
TechHelp Support
Tips & Tricks
Access Forum
Course Index
Topic Glossary
Insider Circle
Home   News   Tips   Glossary   Templates   Forums   Help   Logon   Order   Contact Us  
Tips & Tricks

New Tips Added Weekly!
Click here to get on our Mailing List


Microsoft Access Parameter Query

Asking the user for criteria when you run your queries

Q: I would like my users to be able to change the criteria for a query, but not have to learn how to make design changes. For example, when I run a query of customers by state, I want the user just to be able to type in the state when the query runs - perhaps with a prompt. Any ideas?

A: To do this, use an Parameter Query. To do this, just place a criteria for the field(s) you want to have parameters for, and put a prompt for your user inside of square brackets. Like this:

Now when your query runs, you'll be prompted to enter the state as a parameter.


Here is a FREE VIDEO TUTORIAL that will walk you through this topic in detail.

I teach the concepts in this free mini tutorial in my Access 102 course. These are full courses - over 60 minutes in length each. I spend a lot more time going over how to do this, in addition to lots more tips and tricks.

UPDATE: I also cover Parameter Queries in a lot more detail in Access 2010 Beginner Level 5.


By Richard Rost   Richard Rost on Facebook Richard Rost on Twitter Richard Rost on Google Plus Richard Rost on LinkedIn Email Richard Rost

Click here to sign up for more FREE tips



Student Interaction: Creating a Parameter Query

Richard on 4/1/2008:  I hope you enjoyed this free tutorial. Please post any questions or comments you have here.
Gregg on 9/29/2009: How do you get an Access 2007 parameter query to prompt the user "Record Not Found" when an input value is not on the dataset?
Richard Rost on 9/29/2009: Gregg, you can't do this with just a parameter query. You would need something a little more advanced, like a DCOUNT statement in some VBA code to count the number of records returned.
Mark on 12/20/2009: How can i Query the Hours Worked Table and cal the Total Number of Hours and Total Payment made by customer.
Richard Rost on 12/21/2009: Mark, to get the total number of hours you would use a second query - make it an Aggregate Query and use the SUM function. The same would go for totaling payments.
Bobbin on 9/7/2010: Consider there is a Table with Admit date and and discharge date fields both are same format as follows(10/01/2008). How it is possible If I need to select the customers for last 3 months with admit date/discharge date, How its possible to create query for summary with month if the dates are given in above format
Ken on 9/1/2011: The only thing wrong with the parameter query,is that you can't use it when you are using a lookup list on your fields.
John Mason on 3/6/2012: I am using a parameter query to open a form, using the SSN field, and that works wonderfull, however if the SSN is not in table, it opens a blank form, which is fine, but I would like it to populate the SSN field (1st tab) when it opens the blank. Is there a way to do this?

Reply from Richard Rost:

Of course there's a way to do it. There's a way to do just about everything in Access. Unfortunately, I can't think of a way to do this that DOESN'T involve a little programming. Once you type that parameter into Access' default prompt, there's not a lot else you can do with it.

You could set up your own form that's not bound to a table. All you need in that form is a single text box and a command button. Type the SSN into the text box and click the button to search. The button would execute a DLOOKUP command to see if the value exists in your table. If it does, you would open the person form to that record. If not, you would open the form to a blank record and set the value.

Like I said, this will involve a little bit of programming. I cover all of this in my 300-level Access classes. Unfortunately, I can't think of a NON-programming solution for this problem. Anyone else?

monto on 5/7/2013: When you create a report How are use Dcount function with parameter query
Brauna R on 11/24/2014: Hi Richard,
I use a parameter query to open a report using a date prompt. Is there any way to show the date picker with the prompt?

Reply from Alex Hedley:

If you ware wanting to use a DatePicker you will need to create a Form that handles the Input for your Query and passing that value to the Query.

Have you seen this TIP?

Brauna R on 11/26/2014: Perfect Solution! Thanks

You may want to read these articles from the 599CD News:


Visual Basicindex
Account Login
Online Theater
Lost Password
Free Upgrades
Insider Circle
Student Databases
Change Email
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search Our Site
Waiting List
Production Schedule
Collapse Menus
Live Chat
Customer Support
WalkThru Tutorials
Consulting Services
About Us
Affiliate Program
Richard Rost
Free Lessons
Mailing List
Video Tutorials
MYOLP Memberships
Idiot's Guide to Excel
Volume Discounts
Payment Info
Terms of Sale
Gift CDs
Live Chat
General Info
Support Policy
Contact Form
Email Us
Mailing Address
Phone Number
Fax Number
Course Survey
Facebook    Twitter

Google Plus    LinkedIn

Blog RSS Feed    YouTube Channel
Richard Rost Microsoft MVP