You close a query by using the close button (the x) in the upper-right corner of the Query Design window. How Access responds depends on the following three conditions:
Whether you previously named and saved the query
Whether you made design changes to the query
Whether you made changes to the layout of the query while you were in Datasheet view
If you did not previously name and save the query, Access prompts you with the Save As dialog box when you attempt to close the query. If you previously named and saved the query but did not make any design or layout changes to the query, Access provides no prompts. If you made design changes or design and layout changes, Access asks if you want to save those design changes. If you made only layout changes, Access asks if you want to save the layout changes.
To practice working with queries you're going to create two queries. You will base the first query on the Customers table. The query will ultimately return only salespeople in the United States and then customers in the region BC. The second query will be based on the Orders table. It will locate all orders placed within a specific date range:
Open the Customers table in the Northwind database that ships with Microsoft Access. View the records in this table.
Create a query in Design view, using the Customers table. Add all the fields to the query grid.
Sort the records in ascending order on the ContactTitle and CompanyName fields. Run the query.
Select only the records for customers in the United States. Run the query.
Add to the query criteria to show only the customers whose ContactTitle begins with Sales.
Remove the criteria for ContactTitle and Country and then change the criteria to display only the customers in the BC region.
Close and save the query, giving the query a name.
Create a query based on the Orders table.
Display all orders where the OrderDate is between 7/1/1997 and 8/31/1997. Sort the results by the OrderDate.