Method 1
CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.
-
Open the sample database Northwind.mdb.
- Create a new report based on Employees table.
- Add any fields that you want by dragging them from the fields list.
- If they aren't yet shown on the report, click Page Header/Footer on the View menu to add a page header and footer.
-
On the Insert menu, click Page Numbers, and then click OK.
-
Create a new unbound text box in the header or footer section.
- Click to select the new field, and then on the View menu, click Properties.
- Change the ControlSource property to read as follows:
="Page " & [Page] + [Enter a Starting Page Number] - 1
Print or preview the report. Note that you are prompted for a starting
page number. Starting with this number, each page is numbered consecutively on the report.
Method 2
-
Open the sample database Northwind.mdb.
- Create a new module and type the following code:
'******************************************************
'Declarations Section of Module
'******************************************************
Option Explicit
Global PageChoice As Integer
'===========================================================
'Create the following GetPageChoice() function in the Module
'===========================================================
'This function is called in the OnOpen property of the Report.
Function GetPageChoice ()
Dim choice As String
Do
choice = InputBox("Enter a Starting Page Number:"," _
Number Report", "1")
If Not (IsNumeric(choice)) Then
MsgBox "Value Entered is not a Number."
End If
Loop While Not (IsNumeric(choice))
PageChoice = CInt(choice)
End Function
'==============================================================
'Create the following ReturnPageChoice() function in the Module
'==============================================================
'This function is called by the text box that will contain the
' pagenumber.
Function ReturnPageChoice (pgnumber As Integer)
ReturnPageChoice = PageChoice + pgnumber - 1
End Function
- Compile the module, and then save it as basPages.
- Open the Summary Of Sales By Quarter report in Design view.
- On the Edit menu, click Select Report, and then on the View menu, click Properties to display the property sheet. Change the OnOpen property to read as follows:
OnOpen: =GetPageChoice()
- Select the PageNumber text box in the footer by clicking it. Change
the ControlSource property to read as follows:
="Page " & ReturnPageChoice(Page).
Print or preview the report. Note that you are prompted for a starting
page number. Each page will be numbered consecutively starting with this
number.