Skip to Content

Vb.net Pass Multiple Values to Parameter including subreports

I have a vb.net application that calls a Crystal Report with an embedded subreport. There are 3 parameters in both reports, a Start and End Date, and an EmployeeID that needs to be able to accept multiple values(employees). I set both Reports to accept multiple values on this parameter.

I found this link below that shows how to pass multiple values, but I haven't found how to pass the multiple employee id's to the subreports. I tried to add the code below to my .net code but it seems like the data that is displayed is intermingled between employee id's. I also tried to not pass any parameters at all so that the parameters window in Crystal prompts and get the same intermingled data.

Can I somehow use/tweak the code in the link below to pass multiple values to the subreports as well?

https://archive.sap.com/discussions/thread/1951788

Ultimately, what I am trying to do is to have the Crystal Reports Print Preview display with the user selected multiple employees displayed - this way, the user can click the Print button and select a specific printer, and not use their default printer. Am I going at this entire process correctly, or should I try something different?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Dec 22, 2016 at 03:22 PM

    If the subreport uses the exact same parameter values as the main report, then you don't have to set the values in your code. Instead, link from the parameters in the main report to the corresponding parameters in the subreport so that you only have to set the values once. To do this, open the Subreport Links expert and do the following:

    1. Select the parameters in the top left and move them to the top right.

    2. Select a parameter on the top right.

    3. On the bottom left, select the corresponding parameter from the subreport from the drop-down. This should automatically turn off and disable "Select data in subreport based on field" on the bottom right.

    4. Repeat steps 2 and 3 for each of the three parameters.

    At this point when you set the parameters for the main report, they'll flow through to the subreport without being set in code.

    -Dell

    Add comment
    10|10000 characters needed characters exceeded