UPDATE: I asked a more general question here: Can I do two levels of linking in Crystal Reports?
I'm using Crystal Reports within VB.NET and Visual Studio 2005.
I have a report with several subreports. I'm setting List(Of MainStuff) as the data sources for the main report. I'm setting List(Of SubreportStuff) as the data source for the subreport. Each SubreportStuff has a key which links back to a particular MainStuff, so the report groups each MainStuff item with its related SubreportStuff items. (Or, at the DB level, SubreportStuff items have a foreign key, which is the primary key in MainStuff.)
Below shows the Load function for the dialog, which contains a CrystalReportsViewer. In the Crystal Reports report editor (within VS 2005) I set the subreport link to pull only the related items into that part of the report.
Imports System.Windows.Forms
Public Class dlgMyReport
Private rpt As New MyReport
Public theMainList As New List(Of MainStuff)
Dim theSubreportList As New List(Of SubreportStuff)
Private Sub dlgMyReport_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
rpt.SetDataSource(theMainList)
If theSubreportStuff.Count > 0 Then
rpt.Subreports.Item("subReport").SetDataSource(theSubreportList)
End If
Me.StuffViewer.ReportSource = rpt
End Sub
... ' other subs and functions
End Class
This works fine.
Now, though, what I'm needing to do is in essence the same thing, but pull items based on the keys in the subreport items. This would mean having a subreport within a subreport. However, it doesn't appear that I can do this (the option for inserting a subreport is grayed out when I try to insert in something that is already a subreport).
Is there a way that I can accomplish this? (Can I carry the subreport relationship down another level in some way?)
Thanks as always!
Subreports within subreports are not possible within Crystal Reports.