I'm trying to pass parameters to both main report and subreport, and print reports from the code. The test code below shows what is being done.
sReportPathRPT = "D:\MainReport.rpt"
Set oCRApp = New CRAXDRT.Application
Set oMainReport = oCRApp.OpenReport(sReportPathRPT, crOpenReportByTempCopy)
oMainReport.DiscardSavedData
oSubreport.DiscardSavedData
oMainReport.ParameterFields.GetItemByName("BankName".AddCurrentValue "MainRepParam1"
oMainReport.ParameterFields.GetItemByName("UserID".AddCurrentValue "MainRepParam2"
Set oSubreport = oMainReport.OpenSubreport("SubReport"
oCRReport.ParameterFields.GetItemByName("Pm-?UserID", "Mif".AddCurrentValue "SubRepParam"
'or -> oSubreport.ParameterFields.GetItemByName("Pm-?UserID".AddCurrentValue "SubRepParam"
oSubreport.EnableParameterPrompting = False
oMainReport.EnableParameterPrompting = False
oMainReport.DisplayProgressDialog = False
oSubreport.DisplayProgressDialog = False
oMainReport.PrintOut
oSubreport.PrintOut
"Pm-?UserID" is a parameter field on the subreport linked to the parameter field on the main report.
When I print subreport I get the prompt screen "Enter parameters Values" with "Discrete value" set to "SubRepParam" in my case. I don't get this screen when I print the Main report.
Does anyone know how to supress the "Enter parameters Values" prompt screen from appearing ? Any advice would be appreciated!!!
Roman
sReportPathRPT = "D:\MainReport.rpt"
Set oCRApp = New CRAXDRT.Application
Set oMainReport = oCRApp.OpenReport(sReportPathRPT, crOpenReportByTempCopy)
oMainReport.DiscardSavedData
oSubreport.DiscardSavedData
oMainReport.ParameterFields.GetItemByName("BankName".AddCurrentValue "MainRepParam1"
oMainReport.ParameterFields.GetItemByName("UserID".AddCurrentValue "MainRepParam2"
Set oSubreport = oMainReport.OpenSubreport("SubReport"
oCRReport.ParameterFields.GetItemByName("Pm-?UserID", "Mif".AddCurrentValue "SubRepParam"
'or -> oSubreport.ParameterFields.GetItemByName("Pm-?UserID".AddCurrentValue "SubRepParam"
oSubreport.EnableParameterPrompting = False
oMainReport.EnableParameterPrompting = False
oMainReport.DisplayProgressDialog = False
oSubreport.DisplayProgressDialog = False
oMainReport.PrintOut
oSubreport.PrintOut
"Pm-?UserID" is a parameter field on the subreport linked to the parameter field on the main report.
When I print subreport I get the prompt screen "Enter parameters Values" with "Discrete value" set to "SubRepParam" in my case. I don't get this screen when I print the Main report.
Does anyone know how to supress the "Enter parameters Values" prompt screen from appearing ? Any advice would be appreciated!!!
Roman