Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing parameters to subreport

Status
Not open for further replies.

bardlas

Programmer
Jul 18, 2002
13
CA
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




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top