Click here to Skip to main content
12,892,810 members (56,568 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


3 bookmarked
Posted 8 Nov 2011

SSRS - Error: Subreport could not be shown

, 13 Nov 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
Error trying to get SubReports to show (code in

When trying to get a subreport to show, I found many links on the web all saying one basic thing. In order to show a sub report, you must make sure the parameters are all handled and you must also hook the SubreportProcessing event so you can set the datasource. The code ran fine from the report server, it was only when the report was run in LOCAL mode that it had any issues.

Here is the final solution. When you develop reports in SSBI, the reports are created with the extension of .rdl. That normally works fine when you run them, locally. But if you define subreports, they will get the "Error trying to get SubReport to show" message. Make a copy of your subreport and in that copy, change the extension from rdl ro rdlc and your problem will go away (assuming that you have the correct parameters and you are handing the SubreportProcessing event). That is all there is to it.

// This is the language - xbase to the next level
#USING System.Windows.Forms
#USING System.Data
#USING ReportViewer
#using Microsoft.Reporting.Winforms
#USING wmConsulting.SFM.DataInterface	// this is the business classes
CLASS DailySalesReport INHERIT _frmReportViewer
// ******************************************************************            
// ******************************************************************            
// ******************************************************************            
    LOCAL oReportViewer AS ReportViewer
    LOCAL cReportName   AS STRING
    LOCAL unit_num      AS ReportParameter
    LOCAL sDate         AS ReportParameter
    LOCAL eDate         AS ReportParameter
    LOCAL oParameter    AS ReportParameter[]
    LOCAL dDate         AS DateTime
    LOCAL oDataObject   AS Reports
    LOCAL oDS           AS ReportDataSource
    LOCAL table         AS DataTable
    // set up report parameters
    cReportName         := "Daily Cash.rdl"
    dDate               := DateTime.Parse(cDate)
    oDataObject         := Reports{}
    oDataObject:UserID  := goSysInfo:UserID    
    table               := oDataObject:GetMonthlySummary(nUnitKey,dDate,dDate)
    oDS                 := ReportDataSource{"SFMSales",table}
    unit_num            := ReportParameter{"unit_num", nUnitKey:ToString()}
    sDate               := ReportParameter{"startDate", dDate:ToShortDateString()}
    eDate               := ReportParameter{"endDate", dDate:ToShortDateString()}
    oParameter          := ReportParameter[]{3}
    oParameter[0]       := unit_num
    oParameter[1]       := sDate
    oParameter[2]       := eDate    
    // configure the reportviewer
    oReportViewer                        := SELF:ReportViewer1
    oReportViewer:ProcessingMode         := ProcessingMode.Local
    oReportViewer:LocalReport:ReportPath := cReportName
    oReportViewer:ShowParameterPrompts   := FALSE
    oReportViewer:LocalReport:SubreportProcessing += 
// ******************************************************************            
METHOD SubReportEventHandler(sender AS OBJECT, 
       e AS SubreportProcessingEventArgs) AS VOID
    LOCAL oDS   AS ReportDataSource
    LOCAL table AS datatable
    // fill table here with the appropriate data
    oDS                 := ReportDataSource{"SFMSales",Table}
// ******************************************************************            


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Willie Moore
Network Administrator AT&T
United States United States
Willie Moore is a ”Professional IT – Network Design” for AT&T located in Birmingham, Alabama. He is also the owner of wmConsulting. He has been programming in Clipper since Summer ’87 and has been producing applications in Visual Objects,, PHP,, and C# for the past 20 years He is a Microsoft Certified Systems Engineer and a Microsoft Certified Trainer. Willie can be reached on the Internet at

You may also be interested in...

Comments and Discussions

GeneralMy vote of 5 Pin
Assil12-Jul-12 5:16
memberAssil12-Jul-12 5:16 
GeneralNeed to know how to display if I have 2 or more subreports. ... Pin
ben ong8-Nov-11 18:38
memberben ong8-Nov-11 18:38 
GeneralRe: When you are in the SubReportEventHandler event, look at e.R... Pin
Willie Moore9-Nov-11 2:56
memberWillie Moore9-Nov-11 2:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170424.1 | Last Updated 13 Nov 2011
Article Copyright 2011 by Willie Moore
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid