Skip to Content
0
Former Member
Jul 29, 2009 at 10:52 PM

Null subreport

50 Views

I have a report with 2 not linked subreports. I am trying to open a subreport to pass a dataset and parameters but when I open the first subreport it is null, why? this is the code:

Reports.MoneyReceipt moneyReceiptRDC = new Reports.MoneyReceipt(); // A wrapper to my report.

moneyReceiptRDC.Load();

moneyReceiptRDC.SetDataSource( document.Tables[ 0 ] );

moneyReceiptRDC.SetParameterValue( "pIsPreprintedForm", isPreprinted );

ReportDocument subReport1 = moneyReceiptRDC.OpenSubreport( "Subreport1" ); // After this, subReport1 is still null, WHY?

ReportDocument subReport2 = moneyReceiptRDC.OpenSubreport( "Subreport2" );

subReport1.SetDataSource( document.Tables[ 1 ] );

subReport2.SetDataSource( document.Tables[ 1 ] );

subReport1.ParameterFields.Clear();

subReport1.ParameterFields[ 0 ].CurrentValues.AddValue( documentCurrency );

subReport2.ParameterFields.Clear();

subReport2.ParameterFields[ 0 ].CurrentValues.AddValue( documentCurrency );