Creating a Query with Named Parameters
You can specify names for the parameters in your query to help you distinguish multiple parameters. For example, if you create a parameter query that prompts for an author's name, you can use the parameter names "first name" and "last name." When you run the query in the Query Designer, you are prompted for the parameter by name:
To mark the parameter name as a name and not a string of literal characters, you specify parameter marker characters and then place those characters around the parameter name. For details, see Specifying Parameter Marker Characters.
If you use both prefix-marker and suffix-marker characters, you can name your parameters using any combination of characters, including text, numbers, punctuation, and spaces. (However, do not use null or a question mark.) If you specify only a prefix-marker character, the parameter name cannot contain spaces.
Note The parameter name you specify is used as a variable in the environment from which you run the query. Be sure that the parameter names you use are acceptable in all environments in which you intend to use the query.
To specify a named parameter
- If you have not done so already, specify the parameter marker characters. For details, see Specifying Parameter Marker Characters.
- Add the columns or
expressions that you want to search to the Grid pane. If you are creating aSelect query and do not want the search columns or expressions to appear in the query output, remove them as output columns. - Locate the row containing the data column or expression to search, and then in the Criteria grid column, enter the name of the parameter. Be sure to mark the parameter using the appropriate characters:
By default, the Query Designer adds the "=" operator. However, you can edit the cell to substitute ">", "<", or any other SQL comparison operator.
See Also
Creating a Query with Unnamed Parameters | Parameter Queries | Specifying Parameter Marker Characters