Creating a parameterized query
Parameterized queries allow you to enter search values - or parameters, when a query is performed. If you often perform the same query then creating a parameterized query will allow you to reuse that query, all you need do is change the values that you enter when the query is run. This reduces the need to constantly create or edit new queries unless the focus of your investigation changes.
Parameters are specified when adding conditions in the Query Parameters dialog by prefixing the value in the Value 1 box with an at (@) sign. Any text that you enter after the at (@) sign will be displayed as the parameter label in the Query Parameters dialog so it is a good idea to give your parameters a meaningful name. This will help when you (or another analyst, if you publish the query) perform the query at a later date.
The same parameter name can be applied to one or more fields in your database. When the query is performed you will only be prompted for one value, this value will be applied to each occurrence of the parameter that is defined in the query.
You must enter a value for each of the parameters before the query can be performed. However, if you do not want to enter a value for one or more parameters, for example you may have specified several parameters in your query but you only have values for one of those parameters, you must exclude the parameter from the query by clicking the tick button, the button will change to a cross and you will not be able to enter a value. The parameter will not be used when the query is performed.
This example explains how to use the Query dialog to find all credit card transactions between USA accounts for amounts greater than 20,000 that took place in April using a parameterized query.
This example assumes that the Accounts Example 3 database is already open within the Analyst's Notebook.