Chapter 9: Presenting Data with Access Reports
345
totals as well as group totals. For the Products Summary Report, the page number is printed by
combining the text page, and built-in page number controls. These controls show Page x of y
where x is the current page number and y is the total number of pages in the report. A text-box
control with the following expression in the Control Source property can be used to display
page-number information that keeps track of the page number in the report:
=“Page: “ & [Page] & “ of “ & [Pages]
You can also print the date and the time printed. You can see the page number text box in the Page
Footer section in Figure 9.23. The Page Footer in rptProductsSummary also contains the cur-
rent date and time at the left side of the Page Footer section.
The Report Footer section
The Report Footer section is printed once at the end of the report after all the detail records and
group footer sections are printed. Report footers typically display grand totals or other statistics
(such as averages or percentages) for the entire report. The report footer for the Products Summary
report uses the expression = Sum with each of the numeric fields to sum the amounts.
Note
When there is a report footer, the Page Footer section is printed after the report footer.
The Report Writer in Access is a two-pass report writer, capable of preprocessing all records to cal-
culate the totals (such as percentages) needed for statistical reporting. This capability enables you
to create expressions that calculate percentages as Access processes those records that require fore-
knowledge of the grand total.
Creating a Report from Scratch
Fundamental to all reports is the concept that a report is another way to view records in one or
more tables. It’s important to understand that a report is bound to either a single table or a query
that brings together data from one or more tables. When you create a report, you must select
which fields from the query or table you want to see in your report. Unless you want to view all
the records from a single table, bind your report to a query. Even if you’re accessing data from a
single table, using a query lets you create your report on the basis of a particular search criterion
and sorting order. If you want to access data from multiple tables, you have almost no choice but
to bind your report to a query. In the examples in this chapter, all the reports are bound to queries
(even though it’s possible to bind a report to a table).
It may be obvious, but it bears mentioning that the data in a printed report is static and only
reflects the state of data in the database at the moment the report is printed. For this reason, every
report should have a “printed” date and time somewhere on the report (often in the report header
or footer area) to document exactly when the report was printed.