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!

Problem with parameter passed 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(Crystal 8.5 ,each one based on a different ttx file), and export them to PDF files. The main report has two parameter fields on it and subreport has one.

The test code below shows what is being done.

sReportPathRPT = "D:\Reports\RPT\Main.rpt"
Set oCRApp = New CRAXDRT.Application
Set oCRReport = oCRApp.OpenReport(sReportPathRPT,crOpenReportByTempCopy)

oCRReport.DiscardSavedData
Call oCRReport.ParameterFields.GetItemByName("BankName").AddCurrentValue("MainRepParam1")
Call oCRReport.ParameterFields.GetItemByName("UserID").AddCurrentValue("MainRepParam2")

Set oSubreport = oCRReport.OpenSubreport("Subreport")
oSubreport.DiscardSavedData

Call oCRReport.ParameterFields.GetItemByName("Pm-?BankName", "Mif").AddCurrentValue("SubRepParam")
' or Call oSubreport.ParameterFields.GetItemByName("Pm-?BankName").AddCurrentValue("SubRepParam")

oCRReport.EnableParameterPrompting = False
oCRReport.DisplayProgressDialog = False
oCRReport.MorePrintEngineErrorMessages = False
oCRReport.PaperSize = crPaperA4
oCRReport.PaperOrientation = crLandscape
oCRReport.ExportOptions.DiskFileName = "D:\Reports\pdf\TestMain.pdf"
oCRReport.ExportOptions.DestinationType = crEDTDiskFile
oCRReport.ExportOptions.FormatType = crEFTPortableDocFormat
oCRReport.ExportOptions.PDFExportAllPages = True

oCRReport.Export False

oSubreport.EnableParameterPrompting = False
oSubreport.DisplayProgressDialog = False
oSubreport.MorePrintEngineErrorMessages = False
oSubreport.PaperSize = crPaperA4
oSubreport.PaperOrientation = crLandscape
oSubreport.ExportOptions.DiskFileName = "D:\Reports\pdf\TestSub.pdf"
oSubreport.ExportOptions.DestinationType = crEDTDiskFile
oSubreport.ExportOptions.FormatType = crEFTPortableDocFormat
oSubreport.ExportOptions.PDFExportAllPages = True

oSubreport.Export False

the TestMain.pdf file looks fine with the passed parameters appearing on it, but TestSub.pdf does not show its
parameter. I'm sure I'm missing something or improperly linked the subreport parameter field.
May be anybody can give me an advice how to resolve this problem, I'd appreciate it a lot!!!


Roman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top