Click here to Skip to main content
14,298,693 members
Rate this:
Please Sign up or sign in to vote.
I added a 2nd Subreport to my Crystal Reports and after that I get this error, When I remove the 2nd Subreport it works fine.

I use below code to set datasources for the subreports.

CreateFeePaidXML()

and
CreateAdditionalFeeXML()


both are functions which return datasets.

This is the formula, which works fine before I add the 2nd subreport.

IIF ({PaidFee.paidamount} = 0,'' ,TOText({PaidFee.paiddate},"dd-MMM-yyyy") )


What I have tried:

frmRptViewer.CrystalReportViewer1.ReportSource = rpt
                       rpt.Subreports(0).DataSourceConnections.Clear()
                       rpt.Subreports(0).SetDataSource(CreateFeePaidXML())
                       rpt.Subreports(1).DataSourceConnections.Clear()
                       rpt.Subreports(1).SetDataSource(CreateAdditionalFeeXML())
                       frmRptViewer.ShowDialog()
Posted
Updated 5-Sep-19 11:00am
v2
Comments
nyt72 5-Sep-19 3:49am
   
When I removed the Formula field from the other subreport (which was giving error), now after that the subreport(1) show blank report.
nyt72 5-Sep-19 4:07am
   
Resolved the problem, swapped subreports indexes fixed the problem
rpt.Subreports(1).SetDataSource(CreateFeePaidXML())
rpt.Subreports(0).SetDataSource(CreateAdditionalFeeXML())

but still I thought the report I added first will have o index and the later will have 1 but its not.

I still dont know how to check subreports indexes.

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

As you mentioned in the comments, you have found a solution. Adding this so it no longer shows up unanswered.
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100