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

running totals 1

Status
Not open for further replies.

Saint1234

Programmer
Feb 18, 2004
25
0
0
IE
Hi All,
I have a problem, i have a report with a sub report. From within the sub report I have several records. In the footer of the sub report I am counting how many records there are by doing a count on a field within a running total. I am then passing this value into the Main report. This produces several values throughout the main report which is fine. What i am trying to do is, with another running total (in the main report) I would like to sum all the the values that came from the sub report. The problem is when i try and do a running total the formula field that I need to use does not show up (therefore I cannot select it to do the sum). This is really bugging me, hopefully someone can help.

Many thanks in advance
G
 
In the subreport, you need to set up the running total as a shared variable, as in:

whileprintingrecords;
shared numbervar myrtot := {#cntfield};

This must be placed on the subreport canvas, probably in place of the running total itself.

Then in the main report to use the shared variable, you need to reference it in your new formula, e.g.,:

whileprintingrecords;
shared numbervar myrtot;
numbervar sumrt;

sumrt := sumrt + myrtot;

The main report formula that sums the shared variable must be in a report section below the one in which the subreport is placed, so that the value is available.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top