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!

Sharing totals in a sub report to the main report

Status
Not open for further replies.

ukleaf

Programmer
Mar 16, 2004
27
GB
Hi all,

I have posted about this before, however only got one reply and that was to look in the help section in Crystal. After doing this I am none the wiser!

basically I have a sub report with a total, the formula for this is,

WHILEPRINTINGRECORDS;
SHARED NUMBERVAR LEEDSTOTAL := {#AATOTTIME}+{#ATSTOTTIME};

in my main report, in the footer section I have the following formula,

WHILEPRINTINGRECORDS;
SHARED NUMBERVAR LEEDSTOTAL

Now what I want to achieve here is simply to display the total from the sub report in the main report... what am I doing wrong.

Many thanks
 
One thing to check is the formula in the main report must be in a different section, lower in the report than the sub-report. In other words your sub-report connot be in the footer section also.

Chris
Data Intelligence Group
 
Thanks for the reply Chris,

the sub report is in the details section and the formula with the shared variable is in the report footer on the main report page.

Many thanks
 
Ok, if I am reading your post correctly, what is happening is the value of LEEDSTOTAL is being reset everytime the subreport runs. So the result is the calculation done in the last detail section of the report. IF you want to get a running total, you need:
SHARED NUMBERVAR LEEDSTOTAL := LEEDSTOTAL + ({#AATOTTIME}+{#ATSTOTTIME});

You want to add your fields, add that total to the current value of the variable, then assign the new total to the variable.

I hope this fixes your problem.

Chris
Data Intelligence Group
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top