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!

Assign shared data passed frm main rpt to subrpt selection formula

Status
Not open for further replies.

oicurp

Technical User
Mar 20, 2008
2
US

Hi good people,

I need to refer to a shared variable passed from the main report?

I have done this:
in the main report, defined a formula field as below

whileprintingrecords;
Shared dateTimeVar myTest1:={#MyLastFwdDate}


in the subreport, defined a formula field as below:

whileprintingrecords;
Shared dateTimeVar myTest1;

I want to use the value as one of the condition to select record records from DB and display them on the subreport.
What should I do in the selection formula?

thanks a lot.

Oicurp
 
If you want to pass something back from the main report to a subreport, used Edit > Subreport Links. This will automatically add a statement to the subreport record selection. This can be edited if it is not what you want.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
Just an addition to your shared variable formula: for the formula you've created in the sub-report, modify it as follows:

whileprintingrecords;
Shared dateTimeVar myTest1;
myTest1

The variable won't share without the its name listed after the variable declaration phrase. That should at least give you the value but I'm not sure CR will let you use this in record selection.

 
In the Main Report, just make sure that the shared variable is set in a section before the section containing the subreport.
 

Thank you all, guys.

I've managed to solve the problem with the hint suggested by Madawc.

I created a new Parameter field in the subreport, and linked it to the Running Total field in main report.

It works fines now.

Thanks again.
Oicurp
 
02BNSV,

I disagree. You can share a value without restating the name after the variable declaration line. In fact, to my mind, it is more concise and therefore preferable.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top