ACC2000: How to Specify a Custom Starting-Page Number for a ReportID: Q210514
|
In Microsoft Access reports, page numbering always starts with the
number 1. However, you may want your report to have page numbering
that starts with some number other than 1. This article describes two
methods for defining custom starting-page numbers. Both methods provide
custom page numbers; however, the second method uses Visual Basic for
applications and can therefore include error checking. This method is
more complex, but avoids the possibility that a nonnumeric value will be
entered when you are prompted for a starting number.
Microsoft provides programming examples for illustration only, without warranty
either expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes that you
are familiar with the programming language being demonstrated and the tools used to
create and debug procedures. Microsoft support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to provide added
functionality or construct procedures to meet your specific needs. If you have limited
programming experience, you may want to contact a Microsoft Certified Solution Provider
or the Microsoft fee-based consulting line at (800) 936-5200. For more information about
Microsoft Certified Solution Providers, please see the following page on the World Wide Web:
http://www.microsoft.com/mcsp/For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.asp
="Page " & [Page] + [Enter a Starting Page Number] - 1
'******************************************************
'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
OnOpen: =GetPageChoice()
="Page " & ReturnPageChoice(Page).
For more information about the Page property, in the Visual Basic Editor, click
Microsoft Visual Basic Help on the Help menu, type "page, pages properties" in
the Office Assistant or the Answer Wizard, and then click Search to
view the topic.
For more information about looping structures, in the Visual Basic Editor, click
Microsoft Visual Basic Help on the Help menu, type "loops" in
the Office Assistant or the Answer Wizard, and then click Search to
view the topic.
Additional query words:
Keywords : kbusage kbdta FmrHowto
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: July 6, 1999