Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 209215 - Last Review: June 29, 2007 - Revision: 3.2
How to reset the page number on a group level in an Access report
This article was previously published under Q209215
Moderate: Requires basic macro, coding, and interoperability skills.
This article applies to a Microsoft Access database (.mdb or .accdb) and to a Microsoft Access project (.adp).
When you modify the section properties of a report, you can design a report that breaks the page for each new entry in a group and then resets the page number of the report. For example, the Employee Sales by Country report in the sample database Northwind.mdb is designed with this feature.
Note The method that is used to reset the page number for each new country
depends on whether you want to display the page number in the page header or in the page footer. If you use the wrong method, the page number is not reset
correctly.
Method 1: The page number appears in the page footer
- Start Access and then open the sample database Northwind.mdb or the sample project NorthwindCS.adp.
- Open the Employee Sales by Country report in Design view.
- Click the Country Header section, right-click the On Format property, and then click Build.
Examine the event procedure. - Click the Country Footer section, right-click the On Format property, and then set the ForceNewPage property to After Section.
Method 2: The page number appears in the page header
- Start Access and then open the sample database Northwind.mdb or the sample project NorthwindCS.adp.
- Open the Employee Sales by Country report in Design view.
- Click the Country Footer section, right-click the On Format property, and then click Build.
- Click Code Builder, and then click OK.
- In the Code window, type: Page = 0
- Change the OnFormat event of the Country Header so that the Page property is not set in this event. To do this type an apostrophe before the line with the starting page number.
The code will look similar to the following code:
Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
' Set page number to 1 when a new group starts.
' Page = 1
End Sub
- Click the Page Header section, set the Height property to 0.25, and then set the Back Color property to 8421504.
- Move the control that is named Page Number to the Page Header.
The Page Number control displays the page number
When you use either of these methods, each country begins on a new page,
and the numbering of each new section begins with the number 1.
For more information about resetting page numbers for each group in a report in Access 2000, click
Microsoft Access Help on the
Help menu, type
reset page numbers for each group in a report in the Office Assistant or the Answer Wizard, and then click
Search to view the topic.
APPLIES TO
- Microsoft Office Access 2007
- Microsoft Office Access 2003
- Microsoft Access 2002 Standard Edition
- Microsoft Access 2000 Standard Edition
| kbreport kbhowto kbinfo kbusage KB209215 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate