Error 'the subreport could not be found at the specified location. Please verify that the subreport has been published and that the name is correct'

孤街浪徒 提交于 2019-12-20 10:29:04

问题


I am getting the above error while creating a report in SSRS. I am trying to get 2 data sets from 2 databases, and I did so by creating a master report with data from Dataset1, and a subreport with another dataset.

The error goes away when I create a subreport of the same dataset. Any ideas on what I might have done wrong?

See below screenshots:

The error happens when I do the following:


回答1:


Generally speaking from what I have seen SSRS has THE WORST ERRORS KNOWN TO HUMANKIND on telling you what is wrong. Generally speaking I have seen this one and the main culprit is one of three things:

  1. The Project needs to be rebuilt as you made changes to a subreport and the report data is not current.
  2. The Report data is corrupt some how and needs to be erased (look in your FILE location and delete the *.rdl.data file.)
  3. Your parameter you are passing in is bad or in the wrong format. All Subreports having parameters NEED TO HAVE THEM PASSED IN, or they will not run and give an error the equivalent of 'object set to an instance of a null'.

When you insert a 'Subreport' you may right click and select 'properties'. It has a 'Parameters' side panel you need to select and you need to 'Add' (for each one in the correct order and type) a 'Name' (the parameter name of the report) and the matching 'Value' from the current report passed into it.

EG: So if I had a subreport that wanted a customer to show demographic info on them and I had a master report that had rows of Business data with a customer id each per row. If my subreport took a 'CustomerID' parameter I would have that for the Name and choose '[Customer_ID]' from the current Dataset to pass to it.

You must keep in mind you must 'Add' each seperate parameter that the sub report requires.




回答2:


Delete all the *.rdl.data from your project solution folder.




回答3:


If you have changed the name of the subreport and are getting this error in the preview, just click the 'refresh' icon while in preview mode.

Data is cached for faster preview. Subreports are treated the same way.

Hope this helps.




回答4:


I just had this error and I found that it went away when I cut the sub-report from the main report and then just pasted it back in - Go figure




回答5:


@djangojazz: Thanks a lot for this tricks. The answer for me was #2 AND #3. I detailed it more in case someone has the same problem :

Different messages got for the same error :

  1. Visual Studio Error List : "[rsErrorExecutingSubreport] An error occurred while executing the subreport 'SubOverview' (Instance: 55iS1): Object reference not set to an instance of an object."
  2. Report : "Error : Subreport could not be shown." OR "Error : The subreport could not be found at the specified location"

The solution:

  1. It was all about the parameter (solution #3 from djangojazz) of my sub report which I've wrongly set as Internal. Internal means internal of the subreport not the project. So it's not accessible from the main report but SSRS tells something completely unrelated pointing on the wrong direction. (shame on Microsoft for that)
  2. Once I've set back to "Hidden" (I don't want to let the user to modify those parameters), the issue was the same. Let's go to point 3
  3. Apply solution #2 from djangojazz : Remove the SubOverview.rdl.data (The one corresponding to my sub report).
  4. On my reportServer on the cloud, I've deleted the report SubOverview and relaunch the deployment of the reports to update it. Like that the .rdl.data file is deleted as well.

Hope this helps someone.




回答6:


In my case, I had a VB script error in my subreport. I tried to access a variable, which was only accessible from the report header (current and total page number).

After fixing this mistake, the error was gone.

Maybe this information helps someone.




回答7:


Just had this issue - bizarrely it was due to the subreport dimensions - it was too wide to fit in the placeholder in the master report, so it throws this entirely unhelpful error.




回答8:


I have also been dealing with this issue. My problem was because I renamed the dataset in the subreport but did not change the dataset fields in the expressions.

For example: Original dataset name: dsOriginal New dataset name :dsNew

Original expression: =First(Fields!Field1.Value, "dsOriginal")

New Expression should be: =First(Fields!Field1.Value, "dsNew")

I believe the reason that it says it can't find the subreport is because the subreport definition is invalid, therefore it doesn't compile it. It leaves you with no indication what the problem might be.

Hope this is helpful to others that come looking.




回答9:


2019 IS HERE | IF THE ACCEPTED ANSWER DOES NOT WORK, IF ALL THE ANSWERS ON THE INTERNET DO NOT WORK :

I've figured out what is the "real" problem and made a solution for it after wasting hours and hours so i assure you you're saving time now.

briefly: the problems comes in once you start using parameters to your subreport, The cause is visual studio starts using a newer rdlc xml file structure than the one used to build the main report.

The solution can not be explained by words here so i made a video for the fix, 1:30 long.

https://www.youtube.com/watch?v=Cwd5yHUq1W0

Answer Ended.

From experience, Main and popular issues you will face + the actual meaning and cause of the error:

1- The subreport could not be found at the specified location.

Cause: the file structure of the the subreport is not as the file structure of the main report, the main report may run on an rdlc xml standard version 2008 and the subreport run on version 2016. That happens once you use "parameters"

2-Data retrieval failed for the subreport

Cause: you did not give the subreport the data / dataset / data source it needs, you need to inject an event listener to the main report to be called when the main report encounter a subreport. for more information watch my full video here :

3-subreport could not be shown

This happens when any exception happen during the execution of subreport code or subreport event listener, to find the issue, run vs debugging mode and watch the output window



来源:https://stackoverflow.com/questions/17534606/error-the-subreport-could-not-be-found-at-the-specified-location-please-verify

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!