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 get a sum from Main report and its subreports?

Status
Not open for further replies.

wfuyanli

Programmer
Jun 24, 2006
11
US
Generally speaking, is it possible to calculate the summary from Main report and subreport?
Ma case :
I have a main report Main.rpt, it has field m1 and m2,
two subreports sub1 and sub2, sub1 has fields s1 and s2,
sub2 has fields s3 and s4, is it possible that I can get a Sum of all the numbers- m1+m2+s1+s2+s3+s4=?

Thanks a lot!!!
 
yes, you can sum all - as long as you made the variables shared from the subreport and the main report
 
Don't know where your subs are located, but let's say they are in RF_a and RF_b. In the first subreport, create a shared variable like:

whileprintingrecords;
shared numbervar s1s2 := sum({table.s1}) + sum({table.s2});

In the second subreport, create a shared variable like:

whileprintingrecords;
shared numbervar s3s4 := sum({table.s3}) + sum({table.s4});

Place each formula in the report footer of its particular subreport. Then in the main report, insert an RF_c, and place the following formula there:

whileprintingrecords;
shared numbervar s1s2;
shared numbervar s3s4;
sum({table.m1})+sum({table.m2}) + s1s2 + s3s4;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top