I am trying to create a simple Master Details report in a Winform application with a Master Table, Detail Table in a dataset. I have followed the instructions for setting up a Master Details report. My SubReport (CheckItemsSRPT) has a Parameter called "IDNum" defined as an integer (as is the field idnum) which allows nulls. , and a filter =fields.IDNum = =Parameters.IDNum.Value.
The Master Reports is grouped by the IDNum field. It has a subreport in the details section whose ReportSource is defined to the type CheckItemsSRPT with Parameter.IDNum, and a filter {=Fields.IDNum = =Parameter.IDNum.Value}
When I Preview the report in design time the data in the details section shows up as expected.
During runtime a dataset is filled with data and transferred to the report. (See Code Below)
The data in the Master table appears in the report as expected, but the subreport only renders the data of the default value of the Parameter.IDNum (Also the report only renders after a manual refresh).
I have set a breakpoint both at the SubReport1.Itemdatabinding event in the ChecksReport, and in the itemdatabinding event of the CheckItemsSRPT and the parameter.IDNum does not change its value. What am I missing?
'Master report datasource
ObjectDataSource()
mydsItems.DataSource = BudgetsDS1
mydsItems.DataMember = "CheckItems"
'Master Report
Dim myrpt As new CheckRpt()
myrpt.DataSource = myds
'Detail Report
dim mysubrpt as new CheckItemsSRPT()
mysubrpt.DataSource = mydsItems
Dim rssub as new InstanceReportSource
rssub.ReportDocument = mysubrpt
'Assign Details to SubReport Control
Dim myctrl As SubReport =TryCast( myrpt.Items.Find("SubReport1",True)(0),SubReport)
myctrl.ReportSource= rssub
'Assign ReportSource to Viewer Control in form
Dim ms as new InstanceReportSource
ms.ReportDocument = myrpt
Dim myfrm as new CheckViewervb()
myfrm.ReportViewer1.ReportSource = ms
myfrm.Show()