Link to home
Start Free TrialLog in
Avatar of Brad_Shillito
Brad_Shillito

asked on

Printing total page count on subreport pages in a main report

I have several multipage sub reports I inserted into separate report heading sections of the main report.  These must be in separate sections beacuse some sub reports are profile orientation and some are landscape orientation.
I need to display the page number and total number of pages at the bottom of each page.

I  am able to do this sucessfully with the page number. I have a shared variable for page number I set this shared variable equal to the PageNumber in the main report before inserting the subreport. In the subreport I add the subreport PageNumber to this shared variable before displaying it at the bottom of the page of the subreport.

I tried a similar method using a shared variable for TotalPageCount. In the main report I set this varialble equal to the TotalPageCount prior to inserting the subreport. When I display this shared variable at the bottom of the page of the subreport it shows the correct number of pages on page 1 but on page 2 it displays an unintialized number 4,294,96....
I do not understand why my method is OK for page number but not page count?
Avatar of Mike McCracken
Mike McCracken

The page number is known when you generate the subreport.  However the total page count isn't known until the entire report is rendered.  Try moving to the last page of the report then back to the first and see if the page numbering works.

mlmcc
When I have sub reports and require page numbers, I actually put the N of M in my Main report page footer, rather than in the sub report.

Depending on what you are doing exactly, this might work for you too.

Avatar of Brad_Shillito

ASKER

LininDenver
Because I have my SubReports in Separate Page Header sections,
Placing the N of M in the page footer only prints on the last page.

What section do you have your sub reports inserted when you get this to work?
Do you have multiple pages in your sub reports?
mimcc
I am not sure what you mean by
"Try moving to the last page of the report then back to the first and see if the page numbering works"
.
ASKER CERTIFIED SOLUTION
Avatar of LinInDenver
LinInDenver
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
LininDenver:

I saw online a solution using group header as you suggested.
What was not clear to me is do you use a separate groupheader for each report or insert all into the same group header?
I need a separate group header so I can change from portfolio to landscape orientation for some of the reports.
Hi Brad!

Put them in different group header sections (right click on GH1 and insert section - as many as you need for each sub report)  - it allows you to do what you describe (change portrait/landscape) and also prevents your sub reports from printing on top of each other.

Let me know if that makes sense.
I tested your suggestion using multiple group headers and was succesful.  I still would like to know if there is a way to get my shared variables to work, but for now I can get done what is required.
Until You generate the complete report you don't know the number of pages the report takes.  by clicking the >> in the paging, you force the report to generate the complete report and thus you have the number of pages.

mlmcc