0
votes

I built two reports in SSRS: one master report and one subreport. The subreport is embedded in the master report. There are several parameters that the subreport takes: Begin date, end date, etc.

I then tried to run the master report and received error saying the subreport could not be shown. I googled about this error and discovered that the type of the parameter being passed to the subreport should match the type of parameter that the subreport accepts.

Bearing this in mind, I checked more than dozen times of the types of parameters passed to the subreport. No luck.

1

1 Answers

0
votes

I answered my own question because I figured this out in the end without any luck finding the solution from google. Also I thought somebody else might have the same problem.

This problem is like a special case of the type issue. While the type of data being passed to the subreport should match the type of the parameter that subreport takes, the story changes when you are trying to pass type DATETIME.

Say your master report takes in some DATETIME type parameter (In my case my master report takes Begin Date and End Date, both of which are DATETIME type parameters). When you are calling the subreport that also takes DATETIME parameter, you NEED TO change the DATETIME type to TEXT type (in the context of SSRS), or string. Keeping DATETIME type will cause the error of not showing the subreport.

I figured this might be due to that DATETIME type that should have been accepted in the subreport is implicitly converted to TEXT type behind the scene.

UPDATE (12/05/2017): I should be more clear about this: by changing the datatype I don't mean you should change the type of parameter, but you should consider to use Format function in the expression when passing this DATETIME type parameter to the subreport so that this parameter will be formatted as a string.