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!

Subreport Values not resetting

Status
Not open for further replies.

acrouch

Technical User
Oct 29, 2001
9
AU
Hi,

I am running Crystal V10 on an SQL 2000 DB, using an SQL ADO Driver.

My main report lists all Customer Transactions, my sub report shows all customer receipts.
The desired outcome of my report is to show any customer transactions less any allocated receipts, hence showing an overall o/s balance for that transaction.

I have shared variables in the report, which display and calculate. The issue is that where I have a transaction in the main report with no information in the subreport, the shared variable total from the detail line above it appears in the shared variable field for that line.

The shared variable only appears to reset when there is a line in my subreport to populate it with.

The variables are as follows...

In the subreport

Variable_InvSumApplied

WhilePrintingRecords;
shared numbervar Variable_InvSumApplied :=
Sum ({RCT2.SumApplied}, {RCT2.DocEntry})

In the main report

Variable_SumApplied

whileprintingrecords;
Shared NumberVar Variable_InvSumApplied;

Variable_InvSumApplied

and the reset variable is

Variable_InvSumApplied_Reset

whileprintingrecords;
numbervar Variable_InvSumApplied;
Variable_InvSumApplied :=0

The sub report is situated in Detail A on the main report.
The Shared Variable is in Detail B on the main report.
The Reset Variable is in Detail C on the main report.

An example of what is displaying at present

Cust Code Cust Name Inv No Inv Amt Variable Should BE
C1000 Antoinette 100 5000 1500 1500
C1000 Antoinette 101 2500 2500 2500
C1000 Antoinette 108 100 2500 0
C1000 Antoinette 101 6000 6000 6000


Any help is greatly appreciated.

Kind Regards

Antoinette
 
Your reset variable isn't a shared variable, change it to:

Variable_InvSumApplied_Reset
whileprintingrecords;
SHARED numbervar Variable_InvSumApplied := 0

-k
 
Hi,

Thank you so much, I have wasted so much time moving the subreport and variable fields into different sections, and all it was, was one word....

I feel like an idiot !

Your help is greatly appreciated !!

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top