How to Design sub report with classical CR 8.5 in VB6 IDE

Widyanahar: 3 march: 2008

I am trying to write this article due to the fact that it is uneasy to get howtos or step-by-steps info for this issue, even with our google, it is still hard to find out.

Thought that many of you experiencing the same problem on this! This article should be useful for those who is still in middle of legacy system which is running crystal report 85 with VB6 desperately. (You know that this is 2008).



Here is the code for accessing the subreport:

cr.DiscardSavedData

cr.Database.SetDataSource rsmain, 3, 1

cr.Subreport1.OpenSubreport.Database.SetDataSource rssub, 3, 1

cr.Subreport1.OpenSubreport.Database.Verify

frmReportView.CRViewer1.ReportSource = cr

frmReportView.CRViewer1.ViewReport

frmReportView.Show vbModal

Note: you use Active Data, prepare two ADO Recordset for main report dan subreport , say both as rsmain as rssub.

Here is the step-by-step:

  1. The report files is included within the vb projects (.dsr file) rathe than .rpt, representing the main report and sub report.
  2. The Sub Report file will be placed in one of sections within main report design, by insert report procedure (rightclick the design form, insert/subreport)
  3. There must a field as conjuction/link between main report and subreport. That is a field that exist in rsmain and rssub. In this example, the field is CustomerID.

here is the menu to prepare the link :




4. After subreport insertion, subreport created once will not be used anymore for editing. You should use the subreport inserted by rightclicking subreport part in the mainreport form and click Edit SubReport as depicted below.


5. After step 4, you must have tab main Report dan Sub Report named crDetail. From this sub report, you should do your design work.


hope this helpful.


wid, 2008

1 comment:

  1. Anonymous1:41 PM

    very very helpful
    this damn that i'm looking for
    great!!

    thank you,

    ReplyDelete