Footers are most often used to summarize report information. For example, a Group Footer could total the number of harassing phone calls each telemarketer made and the Report Footer could calculate the number of harassing phone calls made by all telemarketers.
If you create a report using the (the preferred method), you will specify which fields you want to summarize and the calculation you want to use to summarize them. Of course, you can always add your calculated control or calculated field to summarize information on an existing report. Figure 8-19 shows an example of a calculated control. A calculated control displays totals and other arithmetic computations on a form or report. Table 8-5 describes the functions you will use most often to summarize your reports.
Make sure you have the modified rptEmployeeSales report you worked on in the previous lesson open in Design view.
The section footer in which you place a calculated control is very important, as each footer section calculates/summarizes records differently:
Group Footer: Calculates all the records in a group.
Page Footer: Calculates all the records on the page.
Report Footer: Calculates all the records in the report.
You want to add a calculated control to the Report Footer that will calculate the total sales for all records. First though, you will need to resize the Report Footer so that there is enough room to add such a control. Here's how to change the size of a section.
Click and drag the Report Footer section divider down a half-inch.
Now that you have enough room in the Report Footer you can add the calculated control. There are two ways to add a calculated control to a form or report:
Click the Text Box control on the Toolbox and click and drag where you want to add the control.
Copy an existing text box control, select the desired location, and paste the copied text box control.
You can use either method, but the copy and paste method is a little faster and easier because it copies formatting options and gives the new control a consistent look.
Select the Total text box control in the Detail section and click the Copy button on the toolbar. Click the Report Footer section divider and click the Paste button on the toolbar.
Access pastes the copied control. Next you have to add an expression to the control.
With the new Total text box in the Report Footer still selected, click the Properties button on the toolbar.
The Properties dialog box appears. You need to enter the expression in the Control Source property, which you can find on the Data tab.
Click the Data tab, click in the Control Source box, type =SUM([Total]), and close the Properties dialog box.
You're finished adding a calculated control that will total the Total fields on the report.
Next you want to add another footer and calculated control that will total the total sales by employee. First you need to add an Employee Group Footer section to your report.
Click the Sorting and Grouping button on the toolbar.
Tip: Another way to sort and group is to select View
The Sorting and Grouping dialog box appears.
Click the Employee field, click the Group Footer box in the Group Properties section, click the list arrow, select Yes from the list, and then close the Sorting and Grouping dialog box.
Because the Total text box control you created in Steps 3-5 already contains the SUM expression you need, you can simply copy and paste the control in the Group Footer.
Copy the Total text box control in the Report Footer section, click the Employee Footer section divider, and paste the control.
You need to add some meaningful labels to your report. Often, it's useful to add a calculated control that mixes some text with the current value of a field to produce an informative notice for the report.
Copy the Total text box control in the Employee Footer section and paste it in the same section. Change the Data Source property of the pasted control to ="Total for " & [Employee].
This expression will display the text "Total for" and the employee's name. Let's finish tidying up the report.
Add a Grand Totals: text label to the Report Footer section, then click and drag the three new calculated fields and one text label so that your report looks like the one in Figure 8-20.
Let's see how our report looks.
Click the View button to switch to Print Preview. Scroll down and notice the calculated controls. When you're finished, save your changes and close the report.