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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pass value from sub report to main report 1

Status
Not open for further replies.

Rbp1226

Technical User
Feb 22, 2008
21
US
I have a report contents main report (with two groups) and two sub reports which located on Report Footer b and Report Footer c, Report Footer a contents grand total for mail report. The sub reports linked with an ID to the main report.
I want to pass values from sub reports to mail report in order to change Page Herder for the sub reports. I tried many ways to place the Shared Variable to different section in main and sub reports, it is no problem pass the value from sub report to sub report, but could not pass the value from sub report to main report, is any one experiences this issue? Please advice.

My sub report formula (SharedGroup):

WhilePrintingRecords;
Shared NumberVar TotalS := 30

My main report formula (SharedGroup):

WhilePrintingRecords;
Shared NumberVar TotalS
 
You can't pass values "up" to previous report sections.

Can you explain what you want in the page header on the pages containing the subreports? How is this different from what you want for the page header for the main report and for report header_a?

-LB
 
Subreport shared variable values are only available to later sections. One trick is to have a very small version of the subreport in an early section, as well as its regular place.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
As lbass and madawc mention, the variable has to appear in a section 'above' the section in which you want to use the data. The shared variable formula in the subreport also must be displayed. To make it show on the same row, go in that section and select 'underlay following section'.

If you want to use the data and not have it display, there are several tricks you can use; color the font white in the subreport or move the subreport off of the canvas- outside of the right margin. If you suppress the field or the subreport, it will not work.
 
All,

Thanks for all the suggestions!
The report actually contents three different reports (with different report title) and use three different table, the customer want combine three reports to one. The issue was – if sub report have more than two pages then the second page will have no report title because the sub report only have report herder, what I try to do is pass any value from sub report in order to write suppress formula and dynamic change the report title on page herder based on which sub report pages show up. Thanks!

Rbp1226
 
It almost sounds like your subreport's page headers are suppressed - Have you tried not suppressing the subreport's page header in your subreports? Don't use the Report header - by design it's only going to print on the first page. I have dozens of reports that have subreports in the footer in which the subreport's page headers appear properly on subsequent pages...
 
Subreports don't have page headers, but you can create fake page headers by creating a formula within the sub:

whilereadingrecords;
""

Insert a group on this formula and select "repeat group header on each page". Then use this group header for your page header info.

-LB
 
lbass,

It works perfect. Thank you so much!

Rbp1226
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top