Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Follow with Report Page Numbers

Status
Not open for further replies.

mrblonde

Technical User
Mar 16, 2001
187
US
I posted this the other day and got a great suggestion. It's been so long since I've coded that I am messing something up. When I go into general Declarations and add Globabl Page number (See Below) the text turns Red. I inserted the function below (Also in the General declarations) and I added a text box in the footer of my reports with the caption property set to the code below. For some reason I get (Name?) in the text box in preview mode. Can anyone fill in the blanks for me here?




mrblonde (TechnicalUser) Mar 16, 2001
Hello,
I have Access 2000. I am creating a set up that will run about 6 reports, each 1-3 pages long. I'd like to have a macro run this, which I know how to do. However, I don't know how to keep the page numbers going. What I mean is Report 1 would run, using pages 1,2,3, and 4. How do I get Report 2 to automatically start at 5?



DougP (MIS) Mar 17, 2001
1st leave off the Pager numbers on all reports
If you create a function that is called from the bottom of each page and store a "Pagenumber" in a global variable it will keep a count for you

----------------- put this in a module -------------
Option Compare Database
Option Explicit

Global PageNumber

------------------ Create this new function
Public Function CountPages()
PageNumber = PageNumber + 1
CountPages = PageNumber
End Function

---------------------- Call it from your report
I put it in the Page footer
="Page " & CountPages()



DougP, MCP


MichaelRed (Programmer) Mar 17, 2001
Also, you would need some way to set PageNumber to 1 at the start of the reporting process (also need to do this to re-run a set of reports)


MichaelRed
redmsp@erols.com



 
First, you cannot have any spaces in your variable names:

Copy and paste this:

Public PageNumber As Integer

Second, make sure you are using a text box for your footer, not a label. Then make sure that the Control Source of the text box is set to ="Page " & CountPages().

As far as resetting it, their are several ways. Here are two:

1) Manually: Open the debug window (ctrl+G) and type PageNumber=1 OR
2) Semi-Manually: Create a form with a button. On the on click of the button put PageNumber=1 Jim Lunde
compugeeks@hotmail.com
Custom Application Development
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top