Subreport in Access : could not be shown


  • Hello everybody,

    For a few months I had the problem "subreport could not be shown", with a reportviewer, either in WinForm or WebForm, and yesterday I discovered the necessity to set the data by code for the subreport, with a SetSubDataSource delegate to declare in the opening of the form/page.

    I tried that with an application based on SQL Server, and it works fine.

    Today, I tried to run an application with a report and a subreport based on an Access database, but I did not it yet. It is a web application, it is quite possible I shall try to do the same in a Windows application afterwards.
    (I presume that when you speak of Reporting Services, it also applies to calling another database ?)

    I develop in C# with Visual Studio 2005, on Windows XP Home.

    I presume a step by step listing of points to verify could help a lot, as this error appears as soon as one point is false in the chain, and the error message has a tendancy to be the same, independantly of what causes it, is this wrong ?

    This is what I did :

    - I created an AccessDataSource for the main report, on the page where the reportviewer is, by double-clicking on the object in the toolbox. With its smarttag, I linked it to the appropriate table (for the moment being, I work with two tables, I shall see for queries afterwards, as I presume it is more simple to work with tables)
    - I created a DataSet for it by adding it to the application via the menu ; I dragued and droped the table from the server explorer.
    - I realized both previous points also for the subreport, but this time I modified the Select query so that it accepts a parameter with the field that will be the link between both tables. With Preview Data, in the contextual menu, I verified I got the correct data, depending on the parameter I seized
    - on the main report RDLC, with the menu Report / Data Sources, I selected the source I just created ; with Report / Parameters, I verified the main report has no parameters
    - the report contains a table, with a subreport control on its middle line. I selected the data source in the DataSetName of the table, from the dropdown list
    - on the subreport RDLC, with the menu Report / Data Source, I selected the source I created for it. With Report / Parameters, I created an Integer parameter (the linked fields in the tables are of type Int32).
    - the subreport also contains a table control. In its properties, I selected the data source in DataSetName, and the filters collection, with one filter. The field name is selected in the list, =Fields!posNumPoste.Value, and for the value, the expression dialog box returned =Parameters!NumPoste.Value
    - on the page where the reportviewer is, I used the smarttag of the reportviewer to select the data source I created for the main report, and the data source object that is linked to it.
    - here is part of the code :
        public void SetSubDataSource(object sender, SubreportProcessingEventArgs e)
         new ReportDataSource(

        protected void Page_Load(object sender, EventArgs e)
            // ...
            ReportViewer1.LocalReport.SubreportProcessing +=
                new SubreportProcessingEventHandler(SetSubDataSource);


    The compilation writes this to the output window :


    The subreport displays "The subreport could not be shown".

    I presume one point to verify is the first argument of ReportDataSource, I do not know how to be sure of what to put in that, I wrote the name of the dataset, followed by an underscore and the name of the datatable.

    Thank you for any advise.

    Here is the configuration of Visual Studio :

    Microsoft Visual Studio 2005
    Version 8.0.50727.762  (SP.050727-7600)
    Microsoft .NET Framework
    Version 2.0.50727 SP1

    Installed Edition: Professional

    Microsoft Visual Basic 2005   77626-009-0005252-41150
    Microsoft Visual Basic 2005

    Microsoft Visual C# 2005   77626-009-0005252-41150
    Microsoft Visual C# 2005

    Microsoft Visual C++ 2005   77626-009-0005252-41150
    Microsoft Visual C++ 2005

    Microsoft Visual J# 2005   77626-009-0005252-41150
    Microsoft Visual J# 2005

    Microsoft Visual Web Developer 2005   77626-009-0005252-41150
    Microsoft Visual Web Developer 2005

    Microsoft Web Application Projects 2005   77626-009-0005252-41150
    Microsoft Web Application Projects 2005
    Version 8.0.50727.762

    Crystal Reports    AAC60-G0CSA4B-V7000AY
    Crystal Reports for Visual Studio 2005

    Microsoft Visual Studio 2005 Professional Edition - ENU Service Pack 1 (KB926601)  
    This service pack is for Microsoft Visual Studio 2005 Professional Edition - ENU.
    If you later install a more recent service pack, this service pack will be uninstalled automatically.
    For more information, visit

    MySQL Connector/Net   6.0.4
    Data design and management tools for MySQL.  Copyright © 2007-2009 MySQL AB

    Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU (KB937061)  
    This Security Update is for Microsoft Visual Studio 2005 Professional Edition - ENU.
    If you later install a more recent service pack, this Security Update will be uninstalled automatically.
    For more information, visit


    Warning: An error occurred while executing the subreport ‘subreport1’: An error has occurred during report processing. (rsErrorExecutingSubreport)


    • Edited by Gloops Thursday, July 23, 2009 8:30 PM
    Thursday, July 23, 2009 8:26 PM