Access VBA Macro Programming

(Joao Candeias) #1
View the Orders report that you created in the previous section in Design mode. Right-click
the horizontal gray bar for “Ship Name Header” and click Sorting and Grouping. Your screen
should now look like Figure 9-9 with a sorting and grouping pane at the bottom of the design
window for your report.
Click More and an orange submenu will display. Click the Footer Section drop-down (the
last item on the submenu) and change this to “with a footer section.”
Close the Sorting and Grouping section. Notice there is an extra section in your report
called “Ship Name Footer.” This footer is displayed every time the Ship Name changes.
Drag a text box onto your new footer section. Line it up with the Quantity box in the
Detail section. Display the properties sheet for this text box and enter=Sum([quantity])into
the Control source property. Set the corresponding label to read “Total.”
Drag another text box onto your new header section but align it to the left-hand side of the
report. Make the size of the box fairly wide. On the properties sheet set the control source to:
="Summary for " & "'Ship Name' = " & " " & [Ship Name] & " (" & Count(*) & " "
& IIf(Count(*)=1,"detail record","detail records") & ")"

118 Microsoft Access 2010 VBA Macro Programming


Figure 9-9 The Report Design window with sorting and grouping shown
Free download pdf