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 bkrike 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 1

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
 
the global PageNumber and the function go inside a standard module, not in the report's code module (click on the module tab, select New, and add the code)

Also add to the Open event for the first Report
PageNumber = 0

then after adding a textbox in the Page Footer for each report, use
="Page " & CountPages()
as the control source for that textbox

PaulF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top