I finally got it to work. I don't know why I didn't see it before, but there is a folder for parameters under report data window. in there were 2 parameters @ParishID and @Parish_ID. when I removed the second with the underscore, the report was happy to display as it was no longer looking for a parameter to be passed that was missing a value.
SSRS sub reports passing values
I have a main report with a bunch of sub reports. I'm trying to pass a parish ID to the sub report from the query field [par_num].
Sub Report:
The query's Parameter:
Parameter Name
@ParishID
Parameter Value
@ParishID
Query Snippet: WHERE tblInfoTechnology.Parish_ID = @ParishID
The Sub Report property(parameters):
Name
ParishID
Value
[Par_num]
I'm getting an error in the main report: one or more parameters were not specified for the subreport. What did I do wrong?
2 answers
Sort by: Most helpful
-
-
Michael Taylor 56,861 Reputation points
2025-01-27T18:58:22.02+00:00 The error indicates an issue with how the main report is passing data to the subreport.
Is this report set up such that you pass some ID as a parameter to the main report and then it renders the data from that ID and uses subreports to display child reports based upon that same ID? If so then in the subreport properties you should be using the main report's parameter.
Name: ParishID Value: [@ParishID]
Here
ParishID
is the parameter defined in the subreport and@ParishID
is the parameter in the main report. If instead you are enumerating rows of data and each row has a subreport then the value would be the field used in the main report's dataset instead. These values should be automatically shown when you use the dropdown list for the value.In the subreport's Parameters section the parameter should be named without the
@
. From the earlier sample that would be it would be calledParishID
. Then inside your query you use@ParishID
.Based upon the error I believe your main report is not properly providing the parameter's value. Note that if the report requires several parameters then ensure you're assigning values to all of them.