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

Shared variables problem

Status
Not open for further replies.

johnism

Technical User
Jul 31, 2002
53
US
I can not get this work , any idea where I am going wrong here?
I am wanting to return a subreport sum and add it to a main report sum.
in the subreport I have this in it's own formula

Shared numbervar Batch :=Sum ({Tkbatch.Qty}, {Tkbatch.Qty})

this is in the main report in it's own formaula

Shared numbervar Batch

the subreport ( when previewed displays the value ) when I preview the main I get a 0 value for the subreport value.
Any ideas where this is going wrong?
Thanks ,
john
 
The display in the main report must occur in a section after the subreport. For instance, you can't have the subreport in the report footer and the display in the header. The value isn't updated until after the subreport is completed.

Lisa
 
Also you may want to be sure that before you use the numbervar you will want to place in the line above it:

WHILEPRINTINGRECORDS ;
Shared numbervar Batch :=Sum ({Tkbatch.Qty}, {Tkbatch.Qty})

WHILEPRINTINGRECORDS also needs to go in the main report as well:

WHILEPRINTINGRECORDS ;
Shared numbervar Batch ;



Mark
Email: markanas333@hotmail.com
 
may I ask why I need to add that ?
It is working with out that ( at this time ).
 
It is a good habit to always specify the eval time of variables. But since shared variable have to be WhilePrintingRecords, it will work without the specification in this case. Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Expert's Guide to Formulas / Guide to Crystal in VB
- tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top