Link to home
Start Free TrialLog in
Avatar of MonkeyPie
MonkeyPieFlag for Australia

asked on

access 2010 report page numbering

I have an access report grouped on employee.  I want a new page for each employee.  To stop both blank page at end, and empty first page after report header, I use the following vba:

Private Sub GroupHeader0_Print(Cancel As Integer, PrintCount As Integer)
    'after first name change, set FORCE NEW PAGE to be before change in name - this will stop a blank page being printed at end of report
    Me.Section(acGroupLevel1Header).ForceNewPage = 1 'before change in name

End Sub

Open in new window


This works well, except for the auto numbering page x of y.
I end up with page 40 of 28 on the last page of this report.
How can I fix this?
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Not sure why you are getting a blank page.
Perhaps it would be better to examine the design of your report to eliminate the blank/last page...
Avatar of MonkeyPie

ASKER

If I want to take new page for each employee, without using VBA, I either have to set 'force new page' to TRUE for before new employee (which would give me the report header on one page, and then take a new page to start first employee - which I don't want), or I could set 'force new page' for after employee footer - which would give me a new page after last employee.

Or am I wrong here?
You are correct, my point was that depending on your exact design, there may be another way to control the breaks and pagecounts

In other words, (unless I am missing something here)
It would be best to post a sample DB of this.

With reports, there are just too many settings that can effect things like this...

Sample database notes:
1. Back up your database(s).
2. Combine the front and back ends into one database file.
3. Remove any startup options, unless they are relevant to the issue.
4. Remove any records unless they are relevant to the issue.
5. Delete any objects that do not relate directly to the issue.
6. Remove any references to any "linked" files (files outside of the database, Images, OLE Files, ...etc)
7. Remove any references to any third party Active-x Controls (unless they are relevant to the issue)
8. Remove, obfuscate, encrypt, or otherwise disguise, any sensitive data.
9. Unhide any hidden database objects
10. Compile the code. (From the VBA code window, click: Debug-->Compile)
11. Run the compact/Repair utility.
12. Remove any Passwords and/or security.
13. If a form is involved in the issue, set the Modal and Popup properties to: No
    (Again, unless these properties are associated with the issue)
14. Post the explicit steps to replicate the issue.
15. Test the database before posting.

In other words, ...post a database that we can easily open and immediately see and/or troubleshoot the issue.
And if applicable, also include a clear graphical representation of the *Exact* results you are expecting, based on the sample data.

JeffCoachman
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Jeff - this is a generic problem that I have now, and also in the past with other applications.

The general layout required is:
report header
first group header/detail/footer
page break
2nd group header/detail/footer
page break
last group header/detail/footer

All with page numbering in page footer with format 'page x of y'

So, it is not just one report, but many.  This layout is fairly standard.  What do others do to stop blank page at end, if they use 'force new page after section'

Thanks,
Sue
Sorry - just missed your last message - will look at sample now.
I did as your sample db.  Fantastic.  That is a much better solution.  Thank you.
Great, Thanks...

Just a note though...
Because my solution uses VBA code, this will only work if the report is opened in Print Preview.