Reset page numbers for each group in a report
Before you do the following procedure, create a macro that uses the SetValue action to change the Page property to 1.
-
Do one of the following:
If the page number is located in the page header, use the following values for the SetValue action arguments:
Item: [Page] and Expression: 0
If the page number is located in the page footer, use the following values for the SetValue action arguments:
Item: [Page] and Expression: 1
- Save and close the macro.
- Open the report in Design view.
- Add a text box to show page numbers in the page header or footer.
- Open the form or report in Design view.
- On the Insert menu, click Page Numbers.
- In the Page Numbers dialog box, select the format, position, and alignment for the page number. For alignment, the following options are available:
Left Page number shows at the left margin.
Center Page number is centered between the left and right margins.
Right Page number shows at the right margin.
Inside Odd page numbers print on the left, and even page numbers print on the right.
Outside Even page numbers print on the left and odd page numbers print on the right.
- To show a number on the first page, select the Show Number On First Page check box.
Note Microsoft Access adds a text box to either the page header or the page footer based on your selection. The ControlSource property is set to an expression based on the format you chose. You can move, size, or position the text box, and set its properties to customize its appearance.
- Do one of the following:
If the page number appears in the page header, set the ForceNewPage property of the first-level group header to Before Section and the OnFormat property of the first-level group footer to the name of the macro you created in step 1.
If the page number appears in the page footer, set the OnFormat property of the first-level group header to the name of the macro you created in step 1 and the ForceNewPage property of the first-level group footer to After Section.
Note The Employee Sales by Country report in the Northwind sample database uses an event procedure in the OnFormat property to reset the page number for each country/region. To view this report, open the Northwind database in the Samples subfolder of your Microsoft Office folder, and then open the Employee Sales by Country report in Design view.