Please help with Crystal Subreport Links
--------------------------------------------------------------------
Using I Crystal Report 9 environment I created a report with a
subreport, a parameter param_main_1 in the main report and a parameter
param_sub_1 in the subreport. Then I linked param_main_1 to
param_sub_1. I placed the field param_sub_1 on the subreport section to
make it active.
From my VB6 application I tried to analyse subreport links.
I created a crystal application object and open a report.
Dim repApp As CRAXDRT.Application
Set repApp = New CRAXDRT.Application
Dim rep As CRAXDRT.Report
Set rep = repApp.OpenReport(txtReport.Text)
Then I found a subreport and opened it
Dim oObject As Object
Dim oSection As Object
Dim oSubReport As Object
For Each oSection In rep.Sections
For Each oObject In oSection.ReportObjects
If oObject.Kind = crSubreportObject Then
Set oSubReport = oObject.OpenSubreport
I retrieved a collection of Subreport links and got my link
Dim oSubreportObject As CRAXDRT.SubreportObject
Dim oSubreportLinks As CRAXDRT.SubreportLinks
Dim oSubreportLink As CRAXDRT.SubreportLink
Set oSubreportObject = oObject
Set oSubreportLinks = oSubreportObject.Links
For i = 1 To oSubreportLinks.Count
Set oSubreportLink = oSubreportLinks(i)
I got a main report field of the link and see its properties (at least
a name)
Dim oMainreportField As Object
Dim mainreportFieldName As String
Set oMainreportField = oSubreportLink.MainReportField
mainreportFieldName = oMainreportField.Name
But I CANNOT retrieve a reference on SubreportField !!!
Dim oSubreportField As Object
Set oSubreportField = oSubreportLink.SubreportField
An error 5 "Invalid procedure call or argument" is raised.
================================================== ======
Could anybody tell me where I am wrong? And how to get a valid
reference on a subreport field of a subreport link?
Thanks in advance
--
crdev
------------------------------------------------------------------------
Posted via
http://www.codecomments.com
------------------------------------------------------------------------