Help and Support
 

powered byLive Search

ACC: How to Reset the Page Number on Group Level in a Report

Retired KB ArticleThis article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
Article ID:104760
Last Review:January 18, 2007
Revision:2.1
This article was previously published under Q104760
Moderate: Requires basic macro, coding, and interoperability skills.
On This Page

SUMMARY

By using a macro, or some code and a report's section properties, you can design a report that breaks the page for each new entry in a group and resets the report's page number. For example, in Microsoft Access 7.0 and 97, the Employee Sales By Country report in the sample database Northwind.mdb is designed with this feature. In Microsoft Access 1.x and 2.0 you can redesign the Employee Sales By Country report in the sample database NWIND.MDB to break the page and reset the page number to 1 for each new country.

Back to the top

MORE INFORMATION

NOTE: The method used to reset the page number for each new country depends on whether the page number is displayed in the page header or page footer. If you use the wrong method, the page number is not reset correctly.

Back to the top

If Page Number Is Displayed in Page Footer


1.Open the sample database Northwind.mdb (or NWIND.MDB in versions 1.x and 2.0).
2.If you are using version 1.x or 2.0, create the following new macro and save it as Pager:
      Macro Name  Action
      --------------------
      Pager       SetValue

      Macro Actions
      ----------------
      SetValue
         Item: Page
         Expression: 1
						
3.Open the Employee Sales By Country report in Design view.
4.In Microsoft Access 7.0 and 97:
      Select the Country Header section, and then click the Build button
      for the OnFormat property to examine the event procedure.
						
In Microsoft Access 1.x and 2.0:
      Select the Country Header section, and then set the section's
      OnFormat property to the Pager macro.
						
5.Select the Country footer section and set the ForceNewPage property to After Section.

NOTE: If you are using Microsoft Access version 1.x or 2.0 and the group header's Height property is set to 0 inches, the page number is not reset correctly. To correct this problem, either set the group header's Height property to at least 0.007 inches or set the group's KeepTogether property to Whole Section in the Sorting And Grouping dialog box to force two-pass formatting. This is necessary because the OnFormat property is triggered too soon when the section has a height of 0 inches.

NOTE: This behavior no longer occurs in Microsoft Access 7.0 or 97.

Back to the top

If Page Number Is Displayed in Page Header


1.Open the sample database Northwind.mdb (or NWIND.MDB in versions 1.x and 2.0).
2.If you are using version 1.x or 2.0, create the following new macro and save it as Pager:
      Macro Name  Action
      --------------------
      Pager       SetValue

      Macro Actions
      ----------------
      SetValue
         Item: Page
         Expression: 0
						
3.Open the Employee Sales By Country report in Design view.
4.In Microsoft Access 7.0 or 97:
      Select the Country Footer section, and then click the Build button
      for the OnFormat property, choose Code Builder, and click OK. In the
      code window type the following:

         Page = 1
						
In Microsoft Access 1.x or 2.0:
      Select the Country Footer section, and set the OnFormat property to
      the Pager macro.
						
5.Set the ForceNewPage property to After Section.
6.Move the control called Page, which displays the page number, to the page header.
When you use either of these methods, each country begins on a new page, and the numbering of each new pages begins with the number 1.

Back to the top

REFERENCES

For more information about resetting page numbers for each group in a report, search the Help Index for "resetting page numbers in reports," or ask the Microsoft Access 97 Office Assistant.

Back to the top


APPLIES TO
Microsoft Access 1.0 Standard Edition
Microsoft Access 1.1 Standard Edition
Microsoft Access 2.0 Standard Edition
Microsoft Access 95 Standard Edition
Microsoft Access 97 Standard Edition

Back to the top

Keywords: 
kbhowto kbusage KB104760

Back to the top

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.