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?
Brad_ShillitoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
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
0
LinInDenverCommented:
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.

0
Brad_ShillitoAuthor Commented:
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?
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Brad_ShillitoAuthor Commented:
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"
.
0
LinInDenverCommented:
Hi Brad!

Yes I have sub reports with many pages.
Most of my reports are designed to drop sub reports into the detail section, mainly because my Main Report doesn't actually do anything but hold sub reports (i.e.: Main report contains parameters to link into the sub reports, but no actual SELECT statement is stored inside it).

If I can't put them in detail, I usually stick mine in a Group Footer. Sometimes this is just a "fake" Overall group - one that groups all my detail into one group. This would be a group on a formula for something like  IF ISNULL(field) then 'Overall' else 'Overall'. You can place sub reports in a "fake" group header or footer like this, and then drop N of M into Page Footer.

I hope this helps.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Brad_ShillitoAuthor Commented:
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.
0
LinInDenverCommented:
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.
0
Brad_ShillitoAuthor Commented:
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.
0
mlmccCommented:
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
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
DB Reporting Tools

From novice to tech pro — start learning today.