Solved

Page numbering for each subreport in a master report.

Posted on 2004-10-01
13
392 Views
Last Modified: 2012-06-21
I have a report that combines 3 subreports in one master report.  

I want to be able to print, on the bottom of each page of the master report, the number of the subreport on that page and the page number within that subreport.  
Example:
If the master report is being printed and subreport 1 spans 2 pages, subreport 2 spans 3 pages, and subreport 3 spans 1 page, the bottom of the report for those pages will be...

Subreport 1 - Page 1
Subreport 1 - Page 2

Subreport 2 - Page 1
Subreport 2 - Page 2
Subreport 2 - Page 3

Subreport 3 - Page 1

*Comment - Each subreport starts on a new page*

The bottom line question is this - Can I tell which subreport is being printed on a particular page?
If I can get this information I can set the the subreport/page information into the footer via vba.
0
Comment
Question by:jhadley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
  • 2
  • +1
13 Comments
 
LVL 66

Expert Comment

by:Jim Horn
ID: 12200716
In all of these reports/subs enter this code in the PageFooter.OnFormat property

Me.MyLabel.Caption = "Whatever this report name is - Page " & Me.Page

You can also use the line above, with & " of " & Me.Pages to display the total number of pages.

Hope this helps.
-Jim
0
 
LVL 4

Expert Comment

by:Excalibur_Software
ID: 12200735
Have you tried placing the Page object in the subreport footer?
0
 

Author Comment

by:jhadley
ID: 12200905
I tried it to confirm.  Subreports do not have pages/page events triggered.
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:jhadley
ID: 12200913
Sorry, I was not very clear.  Jim - I appreciate your suggestion, but it does not work because sub reports don't have page events.  Bummer.
0
 

Author Comment

by:jhadley
ID: 12200972
Excalibur, I may have read your suggestion wrong, but I think it suffers the same limitations as Jim's solution.  Please clarify, if I am missing something.
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 12201005
Every report has a Page Footer, and every Page Footer section has an OnFormat event.

If you can't see it on your report, go to the View menu item and select Page Header/Footer.

-Jim
0
 

Author Comment

by:jhadley
ID: 12201116
Jim
I put your suggested code in the OnFormat event on my first subreport.  If I run that subreport by itself (and not within the master report), it works fine.  Once I put it into the master report that code does not work (in fact it doesn't get called at all) - presumably because subreport don't trigger page events.

Am I missing something in your instructions?
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 12201332
Hmm.. I'd have to test that one, but it looks like you've already done that.  Does the master report's .PageFooter fire even when the sub breaks?
0
 

Author Comment

by:jhadley
ID: 12201371
The master report's page footer fires for each page.
0
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 500 total points
ID: 12206360
As you've noted, the page event doesn't fire for subreports. What you will need to do is to bind the report to a one-record table and create three group headers. Put the subreports into each of the group headers and reset the page numbers like this:
http://support.microsoft.com/default.aspx?scid=kb;en-us;841779&Product=acc
0
 

Author Comment

by:jhadley
ID: 12216848
Your answer will work for the question that I asked, so I will award shaesuebsahakarn the points.  Unfortunately, I actually have more than 10 subreports in the master report.  The proposed solution will work for the three reports I described in me question, but because the maximum number of groups that you can have is 10, it won't work for me.  In trying to make my scenario as easy to follow as possible and I inadvertantly crossed a important criteria boundary that I did not realize existed.

Thanks for the help, and I will probably post another question with more accurate criteria.
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12216856
Don't forget that you can use both the group header and footer for this purpose (giving you a total of 20 sections).
0
 

Author Comment

by:jhadley
ID: 12217034
Thanks for the tip.  I'll give it a try
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question