Chapter 4: Selecting Data with Queries
153
Printing a Query’s Recordset
After you create your query, you can easily print all the records in the recordset. Although you
can’t specify a type of report, you can print a simple matrix-type report (rows and columns) of the
recordset created by your query.
You do have some flexibility when printing a recordset. If you know that the datasheet is set up
just as you want, you can specify some options as you follow these steps:
- Use the query you just created for Connecticut customers who’ve been active since
January 1, 2012. - If you aren’t in the Datasheet view, run the query by clicking the Run button in the
Results group on the ribbon. - Choose File ➪ Print from the Query Datasheet window’s ribbon.
- Specify the print options that you want in the Print dialog box and click OK.
The printout reflects all layout options in effect when you print the dataset. Hidden columns don’t
print, and gridlines print only if the Gridlines option is on. The printout reflects the specified row
height and column width.
Saving a Query
To save your query, click the Save button in the Quick Access toolbar at the top of the Access
screen. Access asks you for the name of the query if this is the first time the query has been saved.
After saving the query, Access returns you to the mode you were working in. Occasionally, you’ll
want to save and exit the query in a single operation. To do this, click the Close Window button in
the upper-right corner of the query designer. Access always asks you to confirm saving the changes
before it actually saves the query.
Creating Multi-Table Queries
Using a query to get information from a single table is common; often, however, you need infor-
mation from several related tables. For example, you might want to obtain a buyer’s name and
product purchased by the customer. This query requires four tables: tblCustomers, tblSales,
tblSalesLineItems, and tblProducts.
Cross-Reference
In Chapter 3, you learned the importance of primary and foreign keys and how they link tables together. You
learned how to use the Relationships window to create relationships between tables. Finally, you learned how
referential integrity affects data in tables.