|
In order to use RPX files as main and subreports, you will need to put your code in the script editor (the yellow cogwheel icon at the top of the ActiveReports design environment) in VBScript, as VB code cannot be saved in this format. Due to limitations in VBScript, you might need to place some of your code in public functions in a class module, which can then be accessed from the script with AddNamedItem. When you run the report, you'll need to use addNamedItem to link the subreport control: Dim oClass As New SubLink Dim rpt As New rptMain rpt.AddNamedItem "cSubLink", oClass Then, within the SubLink class module, you need to create a new ActiveReport and load the layout of your report: Dim rpt As New ActiveReport rpt.LoadLayout reportPath Set oSubReportControl.object = rpt Finally, within the script editor of the main report, you need to add the actual RecordsetPattern to the subreport: Sub onFormat cSubLink.StaticSubLink rpt.Subreport, "sub1.rpx" rpt.Subreport.object.Sections("Detail").Controls("XMLDataControl1").RecordsetPattern = "//breakfast-menu/food[name = """ & rpt.txtField2.Text & """]" End Sub
|