Showing results for 
Search instead for 
Did you mean: 

Crystal Reports - How to pass a parameter from Main Report to a subreport?

0 Kudos

Hi everybody,

I am developing a Crystal Report consisting of a Main Report and a Subreport (Say CR_Main1 and CR_Sub1)

Both reports use only ONE and the same parameter (say @BPCode).

Both reports derive their data from Stored Procedures (which I wrote in Management Studio).

Let's say they are called dbo. usp_main and dbo.usp_sub

I used dbo_usp_main as datasource to populate the main report. This process automatically creates the parameter @BPCode in CR_Main1

I then used dbo_usp_sub as datasource to populate the subreport. This process likewise creates the parameter @BPCode in CR_Sub1

Then I insert the Subreport into the Main Report as hyperlinks (On-demand subreports)

When I run the Main Report, I get TWO blank fields in the Selection Criteria box to enter the BP Code.

I was expecting only ONE input field to appear.

I intend to add up to 10 subreports. So this means I must input the same BP Code in 11 boxes??

Can anyone give me an idea how to overcome the problem of multiple input boxes?

Since I need only one and the same @BPCode for all reports, I want only 1 input box.

The input will then be passed to all stored procedures.

I need to work with stored procedures as my reports are very slow without them.

The parameter needs to be passed to the sp, not CR so that they are run on server, and pass only a limited results set to CR

Any help is much appreciated.


Leon Lai

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Leon

If you Right click on the Subreport cell/box, then a contextual menu will appear.

Choose the option "Change Subreport Links.." and withi the subreport link windows you can setup the relationship between both parameters.

on Top part select the @BPCode parameter and within the bottom part will enalble a listbox with all the possible parameters to be used from subreport. Then select the right one.Press ok.

If you run again the report it should prompt this paremter once.

Best Regards


0 Kudos

Hi Erik

Thanks a lot for your reply.

I do not know how my post appeared twice on the forum, and I did not look at this post.

My question was answerd on the other post.

But your answer is correct. I thank you wholeheartedly and apologise for the confusion.

Best Regards



Answers (1)

Answers (1)

Active Contributor
0 Kudos

Hi  Leon Lai Kan

I think you have open multiple treads for the same question..

Pls close