Microsoft Office Tutorials and References
In Depth Information
5. Save the query as qryCustomersByName , run the query, and then resize the
Customer column to its best fit. Access displays all records from the tblCustomer
table in alphabetical order by the Customer field. See Figure 5-14.
Completed query displaying the Customer calculated field
name is the same
as the nonnull
the customer name is
the concatenation of the
LastName, FirstName for
null Company values
6. Save and close the query.
You are now ready to create the query to satisfy Sarah’s request for information about
customers in a particular city.
Creating a Parameter Query
Sarah’s next request is for records in the qryCustomersByName query for customers in a
particular city. For this query, she wants to specify the city, such as Battle Creek or Hol-
land, when she executes the query.
To create this query, you will copy, rename, and modify the qryCustomersByName
query. You could create a simple condition using an exact match for the City field, but
you would need to change it in Design view every time you run the query. Alternatively,
Sarah or a member of her staff could filter the qryCustomersByName query for the city
records they want to view. Instead, you will create a parameter query. A parameter query
displays a dialog box that prompts the user to enter one or more criteria values when the
query is run. In this case, you want to create a query that prompts for the city and selects
only those customer records with that City field value from the table. You will enter the
prompt in the Criteria text box for the City field. When Access runs the query, it will
open a dialog box and prompt you to enter the city. Access then creates the query results,
just as if you had changed the criteria in Design view.