Data Connectivity
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Data Connectivity
Message Icon Topic: subreport error Post Reply Post New Topic
Author Message
JRCharlie
Newbie
Newbie
Avatar

Joined: 25 Apr 2015
Online Status: Offline
Posts: 15
Quote JRCharlie Replybullet Topic: subreport error
    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

Edited by JRCharlie - 02 Oct 2020 at 3:54pm
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet 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
IP IP Logged
JRCharlie
Newbie
Newbie
Avatar

Joined: 25 Apr 2015
Online Status: Offline
Posts: 15
Quote JRCharlie Replybullet 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,.

Edited by JRCharlie - 05 Oct 2020 at 3:48pm
IP IP Logged
JRCharlie
Newbie
Newbie
Avatar

Joined: 25 Apr 2015
Online Status: Offline
Posts: 15
Quote JRCharlie Replybullet Posted: 09 Oct 2020 at 3:20pm
Thanks
Its working now.
I followed your sugestion and the subreports are working.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.063 seconds.