Microsoft Office Tutorials and References
In Depth Information
Employing Formatting Tips and Tricks
using aggregate functions such as Sum(), Avg(), and Count(). (See Book
IV, Chapter 4 for the scoop.)
Book V
Chapter 1
When you use aggregate functions in a group header or footer section,
Access automatically restricts the records to those in the current group. The
Sum() function, for example, totals the values of a field for all the records
in the group. To subtotal the amount paid for each product in the current
group, you use the following expression in a text box control:
= Sum([Price])
To print the number of records in the report, type the following expression
in the Control Source property (located on the Data tab of the property
sheet) for a text box in the Report Header or Report Footer section:
= Count(*)
Don’t use aggregate functions in the Page Header or Page Footer sections of
a report. If you do, you get an #Error message.
Figure 1-8, earlier in this chapter, shows a report in Design view with Sum()
functions in both the OrderID and ContactID footers (for groupings) and
in the Report Footer section (for the entire report). The Sum() function in
the OrderID Footer section prints a subtotal of the cost for each order, the
Sum() function in the ContactID Footer section prints a subtotal of the cost
for all the orders for each customer, and the Sum() function in the Report
Footer section prints the total cost for all the records in the whole report.
Employing Formatting Tips and Tricks
Following are a few tricks for making nicely formatted controls for your
reports, most of which involve setting report, section, or control properties
on the property sheet:
Printing calculations: Print a calculated field — a field whose contents
are decided by an expression — the same way that you display one
on a form. Create a text box, and enter an expression in the Control
Source property. Be sure to set the control’s Format property, too.
(Book IV, Chapter 4 provides the excruciating details on displaying
calculations on forms; the same methods work for reports.)
Prompting for information to print: Just as Access can prompt for
information when running a query (as described in Book III, Chapter 2),
you can use parameters when printing a report. Parameters allow you to
specify information — usually, in the Report or Page Header or Footer
section — that you want to print. Create a text box control where you
want the information to print. For the Control Source property of the
Search JabSto ::




Custom Search