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

running total

Status
Not open for further replies.

leburg

Programmer
Feb 15, 2006
64
US
Crystal 8.5

Using a subreport to obtain a value that is placed in a shared variable with the main report. I cannot accumulate that field?

Any ideas?

TIA
 
Use two variables. One to do the calculation, and another to accumulate the total. This could be done in the sub report as a Shared variable so it could be passed back to the main report, or in the main report itself as a Global variable. I would take the latter approach. Just amend the formula in the main report that is used to display the variable to something like this (where the variable used in the sub report is called "SRvar"):

Code:
WhilePrintingRecords;
Shared NumberVar SRvar;
Global NumberVar Tot;

Tot := Tot + SRvar;

SRvar

Then, to display the accumulated total, use the following code:

Code:
WhilePrintingRecords;
Global NumberVar Tot;

Hope this helps.

Cheers
Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top