Adding sections that group your records
To create grouping sections (also known as group sections), you tell Access to group the records in your report by the value of one or more fields. For each field, you get a header and footer section for that field. For example, on a report that lists products, you may want to group the records by category, and within category by vendor. If you choose to add both a header and footer section for the group, you end up with Category Header, Vendor Header, Vendor Footer, and Category Footer sections (in that order). To create new grouping sections, display the report in Design view and follow these steps:
- With the report open in Design view, click the Group & Sort button in the Grouping and Totals group of the Design tab on the Ribbon.
Access displays the Group, Sort, and Total pane. You see any fields that are currently used for sorting or grouping the records on your report. If more than one field appears, the topmost field is the major grouping and other fields are subgroups.
- Click the Add a Group button and select a field from the Field/Expression drop-down list to add a section (grouping).
You see a list of the fields in the record source for your report. After you select a field, Access automatically uses an ascending sort (with A at the top) for the new field.
- To sort this field in descending order, click the down arrow next to "with A on top" and select "with Z on top."
Click the More button in the Group, Sort, and Total pane to show the properties for the selected grouping. The default settings for a new grouping have a header section, do not have a footer section, and don't keep all records in each group together on a page.
- You can choose to hide or display headers and footers for the group by using the drop-down arrows next to the appropriate settings. As
soon as you choose to hide or display a group footer or header, Access reflects your changes in the Design view.
Use the Group Header or Group Footer property if you want to print something before the first record or after the last record in the group.
- Close the Sorting and Grouping dialog box by clicking its X button.
Access makes a new grouping with a header and/or footer. You can also use the Group, Sort, and Total pane to delete groupings, and you can set the group properties shown in Table-3 by changing the properties in the Group, Sort, and Total pane.
|Group Property||What It Does|
|Group on||Specifies the field on which the group is based|
|with A on top||Specifies whether the group will be sorted in ascending or descending order|
|by entire value||Specifies whether you want the group to be sorted by the entire field value, the first character, or the first two characters|
|with totals||Specifies whether you want to include totals and how they should be displayed|
|with a header section||Specifies whether you want to include a Group Header|
|with a footer section||Specifies whether you want to include a Group Footer|
|Do not keep together on one page||Specifies whether you want to keep the header and first record together on a page, keep the whole group together on a page, or don't care|
|with title||Lets you choose a title for your group|
You have some control over whether your groups start on a new page, or can be broken and printed on several pages. If you want to start a new page each time a new group starts, change the Force New Page property to the Before Section setting on the Format tab of the Property sheet for the group header section. You can also set the Keep Together property for the group header: The Yes setting keeps the entire group together on one page, and the No setting allows Access to break a group over multiple pages.
In this tutorial:
- Creating and Editing Reports
- What are Forms and Reports
- Creating Reports Automatically
- Running the Report Wizard
- Creating Simple Reports
- Editing Reports in Design View
- Adding page headers, footers, and numbers
- Adding sections that group your records
- Sorting the records in your report
- Calculating group subtotals and report totals
- Formatting Tips and Tricks
- Copying Forms to Reports
- Adding and Formatting Subreports
- Displaying Empty or Long Fields
- Creating Mailing Labels