Closing a Query

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.

Task: Working with Queries


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:

  1. Open the Customers table in the Northwind database that ships with Microsoft Access. View the records in this table.

  2. Create a query in Design view, using the Customers table. Add all the fields to the query grid.

  3. Sort the records in ascending order on the ContactTitle and CompanyName fields. Run the query.

  4. Select only the records for customers in the United States. Run the query.

  5. Add to the query criteria to show only the customers whose ContactTitle begins with Sales.

  6. Remove the criteria for ContactTitle and Country and then change the criteria to display only the customers in the BC region.

  7. Close and save the query, giving the query a name.

  8. Create a query based on the Orders table.

  9. Display all orders where the OrderDate is between 7/1/1997 and 8/31/1997. Sort the results by the OrderDate.

    Part III: Creating Your Own Database and Objects
    Part V: Advanced Topics