Creating Queries

Access gives you three ways to create a query:

  • The Query wizard gives you a quick-and-dirty way to build a simple query. However, this option also gives you the least control.

    Note

    If you decide to use the Query wizard to create your query, then you'll probably want to refine your query later on using Design view.

  • Design view offers the most common approach to query building. It provides a handy graphical tool that you can use to perfect any query.

  • SQL view gives you a behind-the-scenes look at the actual query command, which is a piece of text (ranging from one line to more than a dozen) that tells Access exactly what to do. The SQL view's where many Access experts hang out; for more information on the world of SQL, see Access 2007: The Missing Manual.

Creating a Query in Design View

The best starting point for query creation's the Design view. The following steps show you how it works. (To try this out yourself, you can use the BoutiqueFudge.accdb database that's included with the downloadable samples for this chapter.) The final result—a query that gets the results that fall in the first quarter of 2007—is shown in Figure 6-6.

Here's what you need to do:

  1. Choose Create → Other → Query Design.

    A new design window appears, where you can craft your query. But before you get started, Access pops open the Show Table dialog box, where you can choose the tables that you want to work with (Figure 6-1).

  2. Select the table that has the data you want, and then click Add ...

Get Access 2007 for Starters: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.