The information in this article applies to:
- Microsoft Access version 1.0, 1.1
SUMMARY
This article describes how to consecutively number the pages of multiple
reports. For example, if the first report has 10 pages, then the second
report will begin numbering at page 11.
MORE INFORMATION
This article assumes that you are familiar with Access Basic and with
creating Microsoft Access applications using the programming tools provided
with Microsoft Access. For more information on Access Basic, please refer
to the "Introduction to Programming" manual.
The following steps demonstrate how to consecutively number the pages of
multiple reports:
- Open a new or existing module and enter the following code:
'******************************************************
'Declarations Section of Module
'******************************************************
Option Explicit
Global CurrPage As Integer
'======================================================
'This function returns the page number to be used in the
'consecutive report footer(s). It also increments the Global
'Variable CurrPage.
'======================================================
Function GetPage ()
CurrPage = CurrPage + 1
GetPage = CurrPage
End Function
'======================================================
'This function is called by the first report to initialize the
'Global variable to 0.
'======================================================
Function InitPage ()
CurrPage = 0
End Function
'======================================================
'This function is called from the first report's page footer.
'======================================================
Function SetPage (PgNumber As Integer)
CurrPage = PgNumber
End Function
- Open the first report in Design view by selecting the report in the
Database window and choosing the Design button.
- From the View menu, choose Properties to display the property
sheet. If the report does not already have a report header, choose
Report Hdr/Ftr from the Layout menu.
NOTE: If you do not want a report header or footer, simply resize
the section to a height of 0.
- Click any portion of the report header section not covered by a control
to display the report header properties. Set one of the following
properties for the report header section:
OnFormat: =InitPage()
-or-
OnPrint: =InitPage()
- Click any portion of the page footer section not covered by the
control to display the Page Footer properties.
- Set one of the following properties for the page footer section:
OnFormat: =SetPage(Page)
-or-
OnPrint: =SetPage(Page)
- Open the second report in Design view by selecting the report in
the Database window and choosing the Design button. Create a text box
control in the page footer, and set the following property for the text
box control that you just created:
ControlSource: =GetPage()
- Repeat step 7 for any additional reports you want to number
consecutively.
- Print the reports in order. The pages will be numbered consecutively.
NOTE: To ensure that the reports are numbered correctly, you should print
the reports consecutively without previewing each report. If you want to
preview a report, do not choose Print; be sure to choose Cancel to return
to the Database window and print the reports consecutively.
REFERENCES
Microsoft Access "User's Guide," version 1.0, pages 422-424 and 440-444
Microsoft Access "Language Reference," version 1.0, page 364