Crystal Reports - Dynamically add parameter link between subreport and main report
Hi everyone, here's my issue:
I have a Crystal Report with a sub report in the page footer that has a parameter field. I know that to pass a parameter to a sub report you have to have a parameter on the main report and link the two parameters.
My problem is that there are a number of different sub reports so they are added to the report at runtime based on the user's selection along with the parameter passed to the main report.
How can I perform a link between the dynamically added subreport's parameter and them main report's parameter. I see that there is a .Links method under the properties of the subreport but I don't know how to use it and what format it's looking for. Here's my code of the addition of the subreport:
VB Code:
If Not IsNull(rsReports("Footer")) Then
'Page footer
Set crSection = CReport.Sections.Item("PFa")
crSection.Suppress = False
Set crSubReport = crSection.ImportSubreport(strRoot & "\" & rsReports("Footer"), 250, 100)
With crSubReport
.OpenSubreport
.LeftLineStyle = crLSSingleLine
.RightLineStyle = crLSSingleLine
.TopLineStyle = crLSSingleLine
.BottomLineStyle = crLSSingleLine
.KeepTogether = True
[COLOR=red].Links.Add.MainReportField ("?FootData")[/COLOR]
End With
End If
Any help or tips would be appreciated. Thanks a lot in advance.