Creating a Parameter query in Microsoft Access 2019

When you create a query using Access, there will be times when youwould like your query to prompt you for an item to search for, insteadof committing to one specific set of criteria for a single result.Normally, you would set up queries to run automatically according to thecriteria defined in the query—for example, a specific grade and class,as illustrated in the following screenshot:

ms office 375

You would not want to have to edit your query every time you need togenerate a class list for each different grade in a school setting.Instead, we set up a Parameter query to solve this problem. An exampleof such a query can be seen in the following screenshot:

ms office 452

To differentiate between a normal Select query and a Parameter query,we add square brackets around the criteria we require. In the precedingscreenshot, you will see [Enter Grade here] and [Enterclass], which will, when run, prompt the user to enter agrade and class to show a particular output, as illustrated in thefollowing screenshot:

ms office 754

The first screenshot in this section displays 12 and e”, asthe criteria will only return results for a single grade and class—forinstance, 12e—and it would be very time consuming to have toedit the query each time to get the results you require.

The only difference between typing normal text into the Criteria: section for a field is that aparameter query requires square brackets around the question you ask theuser from the relevant field. A Parameter query displays a dialogbox prompting you for information. A report can also bebased on a Parameter query so that it prompts the user for a particularmonth to print.

Leave a Comment