calling subreports in subreports

  • Thread starter Thread starter ramadevi k via AccessMonster.com
  • Start date Start date
R

ramadevi k via AccessMonster.com

Hi
I have created one report.it includes two subreports named subreport
level4a and
level4b .level4b again contain three subreports like level5a,level5b and
level5c.but while running i am
unable to get data from sibreports in subreport2.i wrote code like
this.plez correct it.it's very very urgent.plez help me.

void callme()
{
Sections crSections;
ReportDocument crReportDocument,
crSubreportDocument,subsubreport;
SubreportObject crSubreportObject;
ReportObjects crReportObjects;

crReportDocument = new Curriculum.Level2ComponentReviewReport();
string query = "select * from Level2ComponentReview";
DataSet ds=UDAL.ExecuteDataSet(query);
ds.Tables[0].TableName="Level2ComponentReview";
crReportDocument.SetDataSource(ds);



string query1 = "select * from Level5AReview";
DataSet ds1=UDAL.ExecuteDataSet(query1);
ds1.Tables[0].TableName= "Level5AReview";
string query2 = "select * from Level5BReview";
DataSet ds2=UDAL.ExecuteDataSet(query2);
ds2.Tables[0].TableName= "Level5BReview";
string query3 = "select * from Level5CReview";
DataSet ds3=UDAL.ExecuteDataSet(query3);
ds3.Tables[0].TableName= "Level5CReview";
string query4 = "select * from Level4AReview";
DataSet ds4=UDAL.ExecuteDataSet(query4);
ds4.Tables[0].TableName= "Level4AReview";
string query5 = "select * from Level4BReview";
DataSet ds5=UDAL.ExecuteDataSet(query5);
ds5.Tables[0].TableName= "Level4BReview";

crSections = crReportDocument.ReportDefinition.Sections;

// loop through all the sections to find all the report objects
foreach (Section crSection in crSections)
{
crReportObjects = crSection.ReportObjects;
//loop through all the report objects in there to find all
subreports
foreach (ReportObject crReportObject in crReportObjects)
{
if (crReportObject.Kind ==
ReportObjectKind.SubreportObject)
{
crSubreportObject = (SubreportObject)
crReportObject;
//open the subreport object and logon as for the
general report
crSubreportDocument =
crSubreportObject.OpenSubreport
(crSubreportObject.SubreportName);
if (crSubreportDocument.Name ==
"Level4AComponentReviewReport.rpt" )
{
ds4.Tables[0].TableName="Level4AReview";
crSubreportDocument.SetDataSource(ds4);
}

if (crSubreportDocument.Name ==
"Level4BComponentReviewReport.rpt" )
{
ds5.Tables[0].TableName="Level4BReview";
crSubreportDocument.SetDataSource(ds5);

if (crSubreportObject.Kind ==
ReportObjectKind.SubreportObject)
{
crSubreportObject = (SubreportObject)
crSubreportObject;
subsubreport =
crSubreportObject.OpenSubreport
(crSubreportObject.SubreportName);

if (subsubreport.Name ==
"Level5AComponentReviewReport.rpt" )
{
ds1.Tables[0].TableName="Level5AReview";
subsubreport.SetDataSource(ds1);
}
if (subsubreport.Name ==
"Level5BComponentReviewReport.rpt" )
{
ds2.Tables[0].TableName="Level5BReview";
subsubreport.SetDataSource(ds2);
}
if (subsubreport.Name ==
"Level5CComponentReviewReport.rpt" )
{
ds3.Tables[0].TableName="Level5CReview";
subsubreport.SetDataSource(ds3);
}
}
}



}
}
}
CrystalReportViewer1.ReportSource =crReportDocument;
}

Regards
ramadevi
 
Does your question pertain to Access reports or Crystal Reports?

--
Duane Hookom
MS Access MVP


ramadevi k via AccessMonster.com said:
Hi
I have created one report.it includes two subreports named subreport
level4a and
level4b .level4b again contain three subreports like level5a,level5b and
level5c.but while running i am
unable to get data from sibreports in subreport2.i wrote code like
this.plez correct it.it's very very urgent.plez help me.

void callme()
{
Sections crSections;
ReportDocument crReportDocument,
crSubreportDocument,subsubreport;
SubreportObject crSubreportObject;
ReportObjects crReportObjects;

crReportDocument = new
Curriculum.Level2ComponentReviewReport();
string query = "select * from Level2ComponentReview";
DataSet ds=UDAL.ExecuteDataSet(query);
ds.Tables[0].TableName="Level2ComponentReview";
crReportDocument.SetDataSource(ds);



string query1 = "select * from Level5AReview";
DataSet ds1=UDAL.ExecuteDataSet(query1);
ds1.Tables[0].TableName= "Level5AReview";
string query2 = "select * from Level5BReview";
DataSet ds2=UDAL.ExecuteDataSet(query2);
ds2.Tables[0].TableName= "Level5BReview";
string query3 = "select * from Level5CReview";
DataSet ds3=UDAL.ExecuteDataSet(query3);
ds3.Tables[0].TableName= "Level5CReview";
string query4 = "select * from Level4AReview";
DataSet ds4=UDAL.ExecuteDataSet(query4);
ds4.Tables[0].TableName= "Level4AReview";
string query5 = "select * from Level4BReview";
DataSet ds5=UDAL.ExecuteDataSet(query5);
ds5.Tables[0].TableName= "Level4BReview";

crSections = crReportDocument.ReportDefinition.Sections;

// loop through all the sections to find all the report objects
foreach (Section crSection in crSections)
{
crReportObjects = crSection.ReportObjects;
//loop through all the report objects in there to find all
subreports
foreach (ReportObject crReportObject in crReportObjects)
{
if (crReportObject.Kind ==
ReportObjectKind.SubreportObject)
{
crSubreportObject = (SubreportObject)
crReportObject;
//open the subreport object and logon as for the
general report
crSubreportDocument =
crSubreportObject.OpenSubreport
(crSubreportObject.SubreportName);
if (crSubreportDocument.Name ==
"Level4AComponentReviewReport.rpt" )
{
ds4.Tables[0].TableName="Level4AReview";
crSubreportDocument.SetDataSource(ds4);
}

if (crSubreportDocument.Name ==
"Level4BComponentReviewReport.rpt" )
{
ds5.Tables[0].TableName="Level4BReview";
crSubreportDocument.SetDataSource(ds5);

if (crSubreportObject.Kind ==
ReportObjectKind.SubreportObject)
{
crSubreportObject = (SubreportObject)
crSubreportObject;
subsubreport =
crSubreportObject.OpenSubreport
(crSubreportObject.SubreportName);

if (subsubreport.Name ==
"Level5AComponentReviewReport.rpt" )
{

ds1.Tables[0].TableName="Level5AReview";
subsubreport.SetDataSource(ds1);
}
if (subsubreport.Name ==
"Level5BComponentReviewReport.rpt" )
{

ds2.Tables[0].TableName="Level5BReview";
subsubreport.SetDataSource(ds2);
}
if (subsubreport.Name ==
"Level5CComponentReviewReport.rpt" )
{

ds3.Tables[0].TableName="Level5CReview";
subsubreport.SetDataSource(ds3);
}
}
}



}
}
}
CrystalReportViewer1.ReportSource =crReportDocument;
}

Regards
ramadevi
 
it is pertained to crystal reports in dotnet
 
Find a crystal reports news group. This NG is for Access Reports.
 
Hi
what's the Url for crystal reports news group.tell me more sites to find
solution to my problem.it's very urgent.

Thanks a lot
Regards
ramadevi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top