Set up Sorting and Grouping of Data in the Report
We are ready to sort our data. MS Access requires
that we do so before we can define groupings. Keep in mind that any sorting in
the source query will be irrelevant.
1.
Select View
--> Sorting and Grouping from the main menu in the Design
View.
The Sorting
and Grouping dialog appears.
2.
Click the top
row within the Field/Expression column.
3.
Click the
selector arrow that becomes visible.
A list
of fields in the Customer_Orders_Source query appears.
4.
Select the CustomerID
field in the list.
5.
Leave the Sort
Order column setting at the default of Ascending.
6.
Click the Group
Header field below the Field/Expression and Sort Order grid
in the dialog (in the Group Properties section of the dialog).
7.
Using the down
arrow in the Group Header field, select Yes to group on CustomerID.
8.
In the same
manner, select Yes in the Group Footer field immediately underneath
the Group Header field.
9.
Leave the
remaining Group Properties at default.
10.
Select the OrderDate
field for the Field/Expression column of the next row.
11.
Leave the Sort
Order column setting, again, at the default of Ascending.
12.
Click the Group
Header field below the Field/Expression and Sort Order grid
in the dialog.
13.
Using the down
arrow, select Yes to group on OrderDate.
14.
In the same
manner, select Yes in the Group Footer field immediately below.
15.
Leave the
remaining group properties at default.
The Sorting
and Grouping dialog appears as shown in Illustration 6.
Illustration 6: Sorting
and Grouping Dialog, with Settings
16.
Close the Sorting
and Grouping dialog.
The
report again appears in an empty state, although our recent settings have been
applied. The telling difference, however, is the appearance, as seen in Illustration
7 (partial view), of the Header / Footer sections for the CustomerID
and ShippedDate fields.
Illustration 7: The
Report with Header / Footer Additions (Partial View)
Having
accomplished the preliminary group and sort criteria, we will begin the process
of bringing data into our currently blank report.