Using+Parameters



****
Often it is not possible to know in advance the criteria for a query field. In such cases, where the filter values are not known until runtime, a variable can be used. When these queries are run, the user is prompted for the value of each parameter. Using parameters in queries is extremely powerful and converts static queries to flexible, dynamic ones. The use of parameters can significantly reduce the number of queries you need, makes queries more useful, and simplifies database maintenance. Parameters can be added very easily. Rather than entering the value of a criteria, enter between brackets the prompt you want the user to see when the query is run. The value the user enters replaces the parameter in the query. In the following example, a parameter [Enter State Name:] is the criteria in the [State] field, and [Enter Minimum Age:] is the parameter in the [Age] field. When this query is run, the user is prompted for the state desired and minimum age, and the records matching that value are retrieved. Parameters work provided the parameter definition does not conflict with the field name among the query's tables.