|
-
Sep 16th, 2003, 02:31 AM
#1
Thread Starter
New Member
Passing value from Sub-Report to Main-Report
Can anyone please help me...
Did anyone know how to pass a sum value (or any value) from Sub-Report to Main-Report?
I mean pass it to a formular or parameter, not just view it on Main-Report.
Please and Thank you.
I am using Crystal Report 8.0 and Ms Access Database.
Report Connection : ODBC Connection.
-
Sep 16th, 2003, 03:15 PM
#2
You need to use a Shared variable.
In the subreport create a formula that contains/calculates the value you want to pass across. Something like
Code:
Shared currencyVar TotalAmount := Sum ({[Order Details].Amount});
In the main report create a formula that uses this shared variable. Something like
Code:
Shared currencyVar TotalAmount;
If TotalAmount > 1000 then
TotalAmount * .1
Else
TotalAmount * .05
Both formulas must use the exact same variable declaration. See the help file for more info on creating variables.
Last edited by brucevde; Sep 16th, 2003 at 03:18 PM.
-
Sep 17th, 2003, 09:17 PM
#3
Thread Starter
New Member
Thanks for your reply brucevde. These code really help me a lot and I think this is very cool. (about the Shared Var)
-
Nov 21st, 2007, 09:51 AM
#4
New Member
Re: Passing value from Sub-Report to Main-Report
Hi.
Sorry about my lack of knowledge, but how do you declare the variable? I don't really use VBA, so where do you do that? It keeps giving me this error:
Compile error:
Expected: line number or label or statement or end of statement
=======================
Here's my code (I just pasted yours above Option Compare Database)
Code:
Shared currencyVar TotalAmount := Sum ({[Order Details].Amount});
Option Compare Database
Thanks
-
Nov 21st, 2007, 10:48 AM
#5
Re: Passing value from Sub-Report to Main-Report
The code shown is used in Crystal Reports and has nothing to do with VBA.
-
Nov 27th, 2007, 09:32 PM
#6
New Member
Re: Passing value from Sub-Report to Main-Report
Sorry
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|