Test Environment: Crystal Reports Basic for Visual Studio 2008
Steps:
- Create Main Report [Eg:myMainReport.rpt]
- Create SubReport [Eg:mySubReport.rpt]
- Pass parameters [From database/through code] to Main report
- Choose which parameter(s) [Eg.{Discount}] you want to pass to Sub Report
- Open mySubReport; Create a parameter in the format [Name]:{Pm-?ParameteName} [Eg:{Pm-?Discount}] as normal parameter field; Place this parameter in the app section of the report to display.
- Open myMainReport; Select ‘mySubReport.rpt’; Right-Click, Click ‘Re-Import sub report’
- Again Right-Click, Click ‘Change sub-report links’
- In the new wizard choose ‘Available Fields’; then select ‘Discount’ under ‘Report Fields’; Drag this to ‘Field(s) to link to’ section
- Under ‘?Discount field link’ dropdown list select {?Pm-?Discount}; This will gred-out ‘Select data in subreport based on field’ tick box and also its dropdown list,Finally click OK.
- Done & Run to Check