Begin the Report by Creating a Query


Usually you'll want to create a report from a query that pulls together data from two or more tables as your record source. You'll create a query that combines key fields from tblCountries, such as area and population, with fields from the other tables that will display the government type and historical legacy.

1.

If your Relationships window is still open, close it.

2.

In the Database window, click Queries. Double-click Create Query in Design View.

3.

In the Show Table dialog box, add tblGovernment, tblCountries, and tblHistory (in that order) to the query. Close the Show Table dialog box.

4.

If necessary, maximize the design window. From the Countries field list, double-click the Country, Area, and Population fields to add them to the grid.

5.

From the Government field list, add GovtType to the grid. From the History list, add HistRule (see Figure 10.3).

Figure 10.3. The query in Design view.


6.

Click the View button at the far left of the toolbar to switch to Print Preview view and view your records.

7.

Choose File, Save and save the query as qryAdministration.

8.

Close the query.

NOTE

The source of a report doesn't have to be a query. For example, you can create an AutoReport, a simple columnar listing of all fields and field values in a table, by selecting the table in the Database window and choosing Insert, AutoReport. In that case, the source for the records is the table itself. But because the power of a relational database is manifest in bringing together data from different tables, queries are a much richer and more pertinent example.





Hands-On Microsoft Access(c) A Practical Guide to Improving Your Access Skills
Hands-On Microsoft Access: A Practical Guide to Improving Your Access Skills
ISBN: 0321245458
EAN: 2147483647
Year: 2005
Pages: 169
Authors: Bob Schneider

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