Hi,
I am wondering if someone can let me know which of the following steps I am doing wrong.
- Have a blank new report ('Blank')
- Have an existing report ('Sub1') which has its own data sources and one parameter (int, named 'Likelihood', with a default value). These are in the same project and same folder.
- Drag the subreport control onto the new report
- In the subreport control properties, select "Sub1" as the "Use this report as a subreport".
- In the parameters tab click Add.
- Try and select a name from the dropdown (it's empty).
- Enter 'Likelihood' as the name.
- Enter '1' as the value.
- Try and preview the report, get 'Error: Subreport could not be shown.' in the preview and 'rsErrorExecutingSubreport] An error occurred while executing the subreport 'SubReport1' (Instance: 0): Object reference not set to an instance of an object.' in the Output (where 'Subreport1' is the name of the control attempting to render the report 'Sub1'.
Things I have tried:
- Entering '=1' as the value.
- Adding a parameter of the same type and name to my main report 'Blank'. Leaving Parameters tab blank in subreport control properties. Also tried setting the value of a 'Likelihood' entry to be equal to the parameter on the Blank report ('=Parameters!Likelihood.Value').
- Setting the name as '@Likelihood' (error about requiring name be CLR compliant).
- Copying the datasources and tables etc. from the subreport to the blank parent report.
The SubReport control rdl:
<Subreport Name="Subreport1">
<ReportName>Sub1</ReportName>
<Parameters>
<Parameter Name="Likelihood">
<Value>10</Value>
</Parameter>
</Parameters>
<Top>2cm</Top>
<Left>2cm</Left>
<Height>7cm</Height>
<Width>7cm</Width>
<ZIndex>1</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</Subreport>
I have encountered many others with similar problems but I have not yet found a solution and would appreciate a point in the right direction.