PDA

Click to See Complete Forum and Search --> : [VB.Net 2005] Passing a Parameter to a Sub-Report


rpc86
Nov 3rd, 2008, 08:26 PM
Hi guys,

I'm having trouble on my project right now. I've been searching threads for passing a parameter to a sub-report.

In my main report, I have only 1 sub-report and I need to pass the value to it. How will I do this? I'm using VB.net 2005 Crystal Report. I use stored procedure in CR and the parameter I want to pass is @CutOff. I use SQL Server 2000.

Thank you very much.

rasinc
Nov 4th, 2008, 07:35 PM
I usually use the subreport links to push a parameter on the main report to the subreport. However, you then mention @CutOff which sounds more like a formula. So when you set up a variable in the @CutOff formula, set it as Shared. Then you can use it in a formula in the subreport by declaring it as Shared again.

The formula must be declared and set in a section above the subreport's section.

mabbas110
Nov 6th, 2008, 01:26 AM
I hope that ur sub report is connected to the main report.
now you need to pass that parameter with the main report object , like i mean to say that pass it like that u have a parameter in the main report.

so it work fine. let me know if you have not understand what i am saying. if there is a parameter in sub report and if sub report is connected then it act like a parameter in main report.

rpc86
Nov 6th, 2008, 06:35 PM
thanks for the input. i have already solved my problem.


crPaySlip.SetParameterValue("@CutOff",dCutOff,"subReport1")


Wherein @CutOff is a parameter from a stored procedure. I use stored procedure as my datasource in CR.