Sunday, March 11, 2012

Export to pdf with parameters

i know how to exprot to pdf and i know how to use parameters but i dont know how to do both together.

Could some please help me. I have a parameter in the report called sbtcode and it is a string value. how can i pass it to the report?

Private Sub Command1_Click()
Dim appl As New CRAXDRT.Application
Dim rep As CRAXDRT.Report
rep.ExportOptions.DiskFileName = "c:\pdf_report.pdf"

rep.ExportOptions.DestinationType = crEDTDiskFile
rep.ExportOptions.FormatType = crEFTPortableDocFormat
rep.Export FalseThis code is from CR 8.5 and VB 6.

Private Sub Command1_Click()
Dim appl As New CRAXDRT.Application
Dim rep As CRAXDRT.Report

'This removes the prompt for the Parameter
rep.EnableParameterPrompting = False

'This sets the parameter to strValue
rep.ParameterFields(1).AddCurrentValue (strValue)

rep.ExportOptions.DiskFileName = "c:\pdf_report.pdf"

rep.ExportOptions.DestinationType = crEDTDiskFile
rep.ExportOptions.FormatType = crEFTPortableDocFormat
rep.Export False

No comments:

Post a Comment