I am building a Master-detail-detail-etc. report but I'm having difficulties in showing the right results in subreports. I'll try to explain the problem:
I do something like this in a property in the MasterReport:
Dim
objReport1 As New SubReportClass
objReport1.ConnectString = ConnectString
objReport1.DateID = DateID
objReport1.StudentID = StudentID
objReport1.ID = value
Me.SubReport1.ReportSource = objReport1
The detailsection shows the results. Works fine.
In subReport1 I want to show another subreport which uses an ID from recordresults from the MasterReport.
In DetailSection1_ItemDataBinding in subReport1 I do:
Dim
section As Processing.DetailSection = (TryCast(sender, Processing.DetailSection))Dim dataRowView As DataRowView = TryCast(section.DataItem, DataRowView)
Dim objReport2 As New SubReportClass2
objReport2 .ConnectString = ConnectString
objReport2 .DateID = DatumID
objReport2 .StudentID = StudentID
objReport2 .GoalID = Integer.Parse(dataRowView("ID").ToString)
Me.SubReport2.ReportSource = objReport2
This shows results but what happens is that the first record of subreport2 shows no results in subreport1 and the second record of subreport2 shows results that belong to the previous record. This how it shows in the ReportViewer. A real print however shows a different result. The first record of subreport2 shows the last record and the second record and further each shows results that belong to the previous record.
I've tried lots of things so far but I can't find a solution.
I hope you understand my explanation and can you offer me some help with this.
Thanks.
Geert