Print Page | Close Window

subreport error

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22903
Printed Date: 18 Apr 2024 at 5:35pm


Topic: subreport error
Posted By: JRCharlie
Subject: subreport error
Date Posted: 02 Oct 2020 at 3:53pm
Hello
Ihave created a report that contains 4 subreports in the page header.
when I try to run the report i received the error table could not be found. I have tried to use one of the subreports as the main report with the same data it works.
This is how i'm populating the subreport.

   Private Sub LoadReport()
        Dim ds As New DS_report
        Dim dt As DataTable = dt_Mach_parts.Copy
        dt.TableName = "Mac_break"
        ds.Tables.Add(dt)

        Dim reprtdoc As New ProductionRprt
        reprtdoc.Subreports("CabParts.rpt").SetDataSource(dt)

        With CR_Viewr
            .ReportSource = reprtdoc
            .Refresh()
        End With
           End Sub



Replies:
Posted By: lockwelle
Date Posted: 05 Oct 2020 at 11:44am
I am not sure. Could it be that the main report has no datasource? Only the subreport is being set.

I am guessing/assuming that the schema for dt matches what the subreport is expecting. Crystal is sensitive about that.

Is the page header the same for all pages? Otherwise, I would expect some linking between the main report and the subreport, and that could be part of the issue.

HTH


Posted By: JRCharlie
Date Posted: 05 Oct 2020 at 2:48pm
Thanks for your reply.
No the main report has no datasource.
I didn't assign any datasourse because it has no fields that required data.
I will try and add a datasourse to the main report and see if it works,.


Posted By: JRCharlie
Date Posted: 09 Oct 2020 at 3:20pm
Thanks
Its working now.
I followed your sugestion and the subreports are working.



Print Page | Close Window