Hi,
We are in the process of migrating actuate reports to crystal.
We have a requirement where we have more than 70 subreports in a report.
We want to execute only some of them as per the condition satisfied.
Is there any way by which we can execute only some ( say 10) subreports and not all of them.
As we all know that when we run a crystal report, all the subreports are run by default.
Even if we suppress, then also the subreports will be run though not shown.
The on demand subreports are also out of scope as current architecture does not permit us to do that.
therefore we are writing a VB code that will execute only those subreports which are needed.
the approach we are trying is that we are creating a new report and then inserting individual subreports into the footer section and then trying executing it.
The code is as below

Option Explicit
'RDC Runtime Objects used in this sample.
Dim crApplication As CRAXDRT.Application
Dim crReport As CRAXDRT.Report
Dim crReport1 As CRAXDRT.Report
Dim crSubReport As CRAXDRT.Report
Dim crSubReport1 As CRAXDRT.SubreportObject
Dim test As CRAXDRT.ConnectionProperties
Dim test1 As CRAXDRT.ConnectionProperties
Dim crSecs As CRAXDRT.Sections
Dim crSec As CRAXDRT.Section
Dim crRepObjs As CRAXDRT.ReportObjects
Dim crSubRepObj As CRAXDRT.SubreportObject
'Dim crSubReport As CRAXDRT.Report
Dim crReport2 As CRAXDRT.Report
Dim i As Integer
Dim X As Integer

Dim t As CRAXDRT.SubreportObject
'Dim Report As New CRViewer1


Private Sub Form_Load()

AddSubreport
CRViewer1.ReportSource = crReport2
CRViewer1.ViewReport

End Sub


Private Sub Form_Resize()
With CRViewer1
.Top = 0
.Left = 0
.Width = Me.ScaleWidth
'Adjust the height to allow room for the
'cmdDeleteGroup button
.Height = Me.ScaleHeight - 700
End With
End Sub

Private Sub Form_Unload(Cancel As Integer)
'Destroy the Report object
Set crReport2 = Nothing
'Destroy the Application object
Set crApplication = Nothing
End Sub


Public Sub AddSubreport()
'(subReportName As String)
Dim crSubreportObject As CRAXDRT.SubreportObject
Dim crSubreportObject1 As CRAXDRT.SubreportObject
Dim crSection As CRAXDRT.Section
Dim crSection2 As CRAXDRT.Section
Set crApplication = New CRAXDRT.Application

'Dim crSection1 As CRAXDRT.Section
'***Import a subreprot into the Report Footer***
Set crReport2 = crApplication.OpenReport("C:\aaa.rpt", 1)

Set crSection = crReport2.Sections.Item("RF")
crSection.Suppress = False
Set crSubreportObject = crSection.ImportSubreport(App.Path & "\aaa.rpt", 0, 0)
Set test = crReport2.Database.Tables(1).ConnectionProperties
test.Item("Server") = "<Server name>"
test.Item("Database") = "<Database name>"
test.Item("User ID") = "<User Id>"
test.Item("Password") = "<Password>"

'Set the Height, and Width of the Subreport object
With crSubreportObject
.Height = 4500
.Width = 7200
End With
End Sub

Here aaa.rpt is a subreport individually saved. What we are doing here is that we are creating a new report and adding this subreport aaa.rpt into the report footer section of the new report. Then we are trying to display that new report. If this succeeds then we will insert another subreport into another footer section and run it. This way it will only execute those subreports which are required.

Everything is going fine in this, its accepting the parameters for only those reports which are required but then it crashes.
Please reveiw the code to find out where are we going wrong.

Also if someone knows some thru which the suppressed subreports doesn't execute by loading some service pack etc. then also please tell me.
your help will be much appreciated.

Thanks in advance,
Sharat