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'
Asked Answered
P

12

29

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:

Same dataset

same dataset

The error happens when I do the following:

enter image description here

enter image description here

Potency answered 8/7, 2013 at 19:40 Comment(6)
I'm going to ask some obvious questions, just to get them out of the way: is the .rdl file of your subreport called "Subreport8"? Have you deployed it to the same server as your main report?Bandstand
The subreport “X” could not be found at the specified location. ... This is an incredibly misleading error, and could mean a lot of different things. The best way to troubleshoot this is to go to the subreport and preview it; then you will return errors that make sense. Usually it’s a missing value, or your parameters arent being passed correctly or at all, etc. Source.Krasnoyarsk
Well the subreport isn't called Subreport8...it's called SSRS Demo. However, every time I delete and add the same report, a new subreport gets created (why...I don't know). So I've removed and added SSRS Demo 8 times.Potency
The subreport SSRS Demo previews fine and I've no errors running it by itself. This error shows up only when I decided to add it as a subreport to that master report with dataset1.Potency
Sometimes, visual studio doesn't refresh the cash and subreports don't work as expected, I suggest you to deploy all your reports on your server and check the error. What does it give ?Gerick
I think I might know what the issue is... it's throwing an error stating that the subreport is missing a parameter. My subreport actually has a date value that it takes in and I think I need to add it in. However, I am not sure how the expressions in SSRS work... could anyone explain and give a detail e.g. of it??Potency
M
84

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.

Manslayer answered 11/7, 2013 at 19:53 Comment(15)
Glad that helped, multi tiered reporting with SSRS can be tricky at times.Manslayer
#2 was my problem. Great answerHeady
Ever tried resolving 'Invalid TLV record' error in Crystal reports? It has a few hundred possible solutions :) Mine usually meant a dll had gone missing...Mac
1 and 3 were already on my SSRS troubleshooting list... Number 2 was new to me and was the problem this time! Thanks!Quarrel
# 2 fixed my problem, but then I got another error ""Data retrieval failed for the subreport, ...", do you have any idea on this?Masaryk
@Hassan: Once you delete the RDL data you need to ensure that the all the reports build correctly. I would select your project and choose 'build' and ensure you can correctly preview the subreport. If you can the problem is in the parameters passed to it in a main report.Manslayer
Pure gold -- #1 was my issue, and +1 for the "worst error messages". I've been led on many a wild chase thinking errors are one thing when they are another completely.Peccable
#2 is the real MVPSymphony
#2 was the one... Often is, but thanks for reminding me!Theorist
Also in regards to #2, if you are using the Asp.net report viewer, make sure to delete the c:\windows\microsoft.net\TemporaryAsp.net files folder for the web project. This will require closing VS.Pachton
I have to say I would have never thought it wold be #2 but that is the real MVP thanksBoring
You sent me down the right path. Specifically, I missed setting LocalReport.ReportEmbeddedResourceHistoried
#2 is always a great bet when stuckResignation
Saves lots of effortRainbow
Should mention that, in regard to point #3 here, you cannot use an asynchronous function to load the data into the subreports, otherwise the data will not be passed in correctly and you will get a data retrieval failed for the subreport error.Addy
D
18

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

Dumdum answered 17/8, 2015 at 6:44 Comment(1)
For me too! Life saver!Sama
C
11

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.

Crackle answered 1/11, 2015 at 19:23 Comment(1)
I changed the name and it was the cause. Problem solved ! Thank youPericline
S
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

Shults answered 5/12, 2019 at 18:13 Comment(4)
Thanks, I had to expand and clarify a few short differences, but yours was perfectly on target. Added my own answer as supplement since too long for a comment here.Gazo
Seriously man, I love you!! I spent days, several days, trying to figure this out. Finally found this answer and it worked!.Kearns
Wow, thank you! Your video about changing from 2016 back to 2008 format did the trick but now I am dying inside :(Pisces
Had to do this in 2021 and this is still the solution. What a mess MS!Leo
P
0

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

Pack answered 14/1, 2014 at 14:22 Comment(0)
A
0

@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.

Antonina answered 30/6, 2016 at 12:40 Comment(0)
H
0

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.

Hairstyle answered 2/2, 2018 at 14:13 Comment(0)
P
0

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.

Prudy answered 23/2, 2018 at 13:41 Comment(0)
F
0

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.

Fib answered 29/11, 2018 at 3:3 Comment(0)
G
0

This is a follow-up to Adel Mourad answer from Dec 2019 with a few caveats. I too ran into this and forgot about the change in the designer. I went into VS2017 and for whatever reason, the designer was gone. Have no idea how/where/why/windows updates or what. Anyhow, after re-installing the designer, I too had a problem with the update running the report.

Few notes to clarify what was presented in the video. The opening reporting namespace changed to 2016, I changed it back to 2008.

Second, from his video, but minor. Where the removal of

<ReportSections>
  <ReportSection>
    <Body...>
  </ReportSection>
</ReportSections>

You only want to remove the outer two ReportSections and ReportSection parts. Leave the body as that is the actual content of the report.

Finally, at the last part for the report parameters. You can KEEP the ReportParameters, but the entire one below that REMOVE ReportParametersLayout.

As for why, and I can only speculate at this point is that the primary report is running 2008 version namespace, so when it gets to a child report trying to run 2016 namespace, that is causing it to choke. I would bet and suggest that if both the primary report and child reports were designed with 2016, it would be fine.

Again, credit goes back to Adel Mourad's answer for me.

Gazo answered 23/6, 2020 at 19:58 Comment(0)
R
0

I had the same problem and none of the suggestions helped. After I deleted the following section at the end of the subreport it worked:

<CodeModules>
    <CodeModule>System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</CodeModule>
</CodeModules>
Retral answered 2/8, 2022 at 12:15 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Areaway
Q
0

This example is only for the standalone report designer to load the subreport from the system. If you have both your subreports and main reports in the same folder, you do not need to provide the entire path. You can simply mention the (report name alone example "x.rdl"), and it will work on both your standalone report designer and web application. However, in the standalone report designer, you cannot load the web server reports

If your reports are stored on the web server and you want to load them in Bold Reports, you will need to download the reports and load the stream file in your web application. For this, please refer to the documentation below. https://help.boldreports.com/embedded-reporting/aspnet-core-reporting/report-viewer/subreport/#load-subreport-stream

Quadruplicate answered 7/6 at 15:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.