Skip to Content
0
Former Member
Feb 20, 2014 at 05:42 PM

Passing a parameter from Main to Sub to use in a Formula

18 Views

I'm trying to parametrize what is essentially a query in a sub-report from the main report.

I need to pass a string "%Drug%" from the main report.

I've created parameters in the main and sub reports and the formula in the sub-report which is "{field} like {parameter}".

The code in VB is:

Dim paramV = New CrystalDecisions.Shared.ParameterDiscreteValue paramV.Value = "%Drug%" UCRpt.ParameterFields(1).CurrentValues.Add(paramV) UCRpt.SetParameterValue(0, paramV, "Subreport4")

Where the last line is (from what I've read) supposed to populate my sub-report parameter.

I've also tried using the customize link to get the value from main to sub.

The error I got before adding the last line was "Missing parameter". After adding the last line I get an error on the code that the index is bad.

According to what I can glean the last line is referencing parameter (0) in the named sub-report.

(Attached images of parameters and linkages)