Part I: Access Building Blocks
154
After you create the tables for your database and decide how the tables are related to one another,
you’re ready to build multiple-table queries to obtain information from several related tables. A
multi-table query presents data as if it existed in one large table.
The first step in creating a multiple-table query is to add the tables to the Query window:
- Create a new query by clicking the Query Design button in the Create ribbon tab.
- Add tblCustomers, tblSales, tblSalesLineItems, and tblProducts by
double-clicking each table’s name in the Show Table dialog box. - Click the Close button in the Show Table dialog box.
Note
You can also add each table by highlighting the table in the list separately and clicking Add.
Figure 4.22 shows the top pane of the query design window with the four tables you just
added. Because the relationships were set at table level, the join lines are automatically
added to the query.
FIGURE 4.22
The query design window with four tables added. Notice that the join lines are already
present.
Note
You can add more tables, at any time, by choosing Query ➪ Show Table from the Query Design ribbon.
You add fields from more than one table to the query in exactly the same way as you do when
you’re working with a single table. You can add fields one at a time, multiple fields as a group, or
all the fields from a table.
Caution
If you type a field name in an empty field cell that has the same name in more than one table, Access enters
the field name from the first table that it finds containing the field name.