Microsoft Office Tutorials and References
In Depth Information
• View the query
results (Figure 2–19).
• Click the View button
to return to Design
view, enter a
different city name, and
view the results.
Repeat this process
with a variety of city
names, including at
least one city name
that is not in the
City ﬁ eld is
in the results
only clients located
in Berridge are
Creating a Parameter Query
If you wanted to ﬁ nd clients located in Fort Stewart rather than Berridge, you would
either have to create a new query or modify the existing query by replacing Berridge with
Fort Stewart as the criterion. Rather than giving a speciﬁ c criterion when you ﬁ rst create
the query, on occasion, you may want to be able to enter part of the criterion when you
view the query results and then have the appropriate results appear. For example, to include
all the clients located in Berridge, you could enter Berridge as a criterion in the City ﬁ eld.
From that point on, every time you ran the query, only the clients in Berridge would appear.
A better way is to allow the user to enter the city at the time the user wants to view
the results. Thus a user could view the query results, enter Berridge as the city and then
see all the clients in Berridge. Later, the user could use the same query, but enter Fort
Stewart as the city, and then see all the clients in Fort Stewart.
To enable this ﬂ exibility, you create a parameter query , which is a query that
prompts for input whenever it is used. You enter a parameter, rather than a speciﬁ c value, as
the criterion. You create a parameter by enclosing a value in a criterion in square brackets.
It is important that the value in the brackets does not match the name of any ﬁ eld. If you
enter a ﬁ eld name in square brackets, Access assumes you want that particular ﬁ eld and does
not prompt the user for input. For example, you could place [Enter City] as the criterion in
the City ﬁ eld.
Removing a Table
from a Query
If you add the wrong
table to a query or have
an extra table in the
query, you can remove it
by right-clicking the ﬁ eld
list for the table and then
clicking Remove Table on
the shortcut menu.