Introducing Query Design View

In Lesson 15, "Creating a Simple Query," you created a simple query using the Simple Query Wizard. This wizard allows you to select the fields from a particular table and then create a standard select query. Although the Simple Query Wizard makes it easy to create a query based on one table, you will find that building more sophisticated queries is best done in the Query Design view.

The Query Design view provides two distinct areas as you work. A Table pane shows you the tables currently being used for the query. The bottom pane, the Query Design grid (see Figure 16.1), enables you to list the fields in the query and select how these fields will be sorted or the information in them filtered when you run the query.

Figure 16.1. The Query Design view is divided into a Table pane and a Query Design grid.

graphics/88fig01.jpg

Opening a Query in Query Design View

One thing that you can do in the Query Design view is edit existing queries, such as the simple query that you created in the previous lesson. You can change the fields used in the query and change the action that takes place on that field (or fields) when you run the query. To open an existing query in Query Design view, follow these steps:

  1. In the database window, click the Queries icon.

  2. In the Query list, select the query you want to edit.

  3. Click the Design button on the database window toolbar.

The query opens in the Query Design window.

Starting a New Query in Query Design View

Creating a new query from scratch in the Query Design view allows you to select both the tables and the fields that you use to build the query. To begin a new query in Query Design view, follow these steps:

  1. Click the Queries icon in the database window.

  2. In the Query list, double-click Create Query in Design View . The Show Table dialog box appears, listing all the tables in the database (see Figure 16.2).

    Figure 16.2. Choose which tables you want to include in the query.

    graphics/88fig02.jpg

  3. Click a table that contains fields you want to use in the query, and then click the Add button (you can also build queries from existing queries or a combination of tables, queries, or queries and tables). Repeat for each table you want to add.

  4. Click Close when you finish adding tables. The Query Design view window opens.

The tables chosen for the query appear in the top pane of the Query Design view. Field names do not appear in the Query Design grid until you add them. Adding fields to the query is covered in the next section.

graphics/tip_icon.gif

Create Table Relationships When you create queries from multiple tables, these tables must be related . See Lesson 9, "Creating Relationships Between Tables," for more information.




Microsoft Office 2003 All-in-One
Microsoft Office 2003 All-in-One
ISBN: B005HKSHB2
EAN: N/A
Year: 2002
Pages: 660
Authors: Joe Habraken

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net