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

Shared Variables & Subreports 1

Status
Not open for further replies.

dBjason

Programmer
Joined
Mar 25, 2005
Messages
355
Location
US
This is actually a continued thread from my earlier post, but figured more people would see it this way.

I have a report and a subreport. I've never worked with shared variables before so I know I'm screwing this up. I'm trying to get the value of one formula filed in the subreport to another formula field in the main report.

In the subreport I have a formula field named 'Verification'. In the formula workshop for that field, I have this declared:

Shared numbervar Verification;
whileprintingrecords;
Verification := {#RTotal0} \\RTotal0 is a running total field in the subreport.


...And it displays whatever RTotal0 displays. Now in my main (parent) report, how can I reference this? I've tried everything from declaring another shared variable with the same name, but it won't do anything. How can I get the amount in the subreport variable 'verification' onto the parent report?

Thanks,
Jason
 
The subreport should have something like:

whileprintingrecords;
Shared numbervar Verification;
Verification := {#RTotal0}

Now AFTER the subreport runs (a section after the subreport), the shared variable can be referenced in the main report as:

whileprintingrecords;
Shared numbervar Verification

You can also use it in formulas. The common mistake is to expect the shared variable to have a value PRIOR to the subreport running.

If you continue to have problems, post technical information:

Crystal version
Database/connectivity used
Where the subreport is (what section???)
Where is the formula attempting to use it's value in the main report

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top