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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SubReport not Showing in export, using RDC in VB

Status
Not open for further replies.

Interwizard

Programmer
Nov 9, 2001
18
US
I have a report that uses the Report Designer Component to preview a report. I give the user an option to export the report to a PDF file and automate the responses to the answers, so that I can manipulate the file once it's created. Here's the problem - one of the subreports in the report do not show up in the export that I automate, but If I export from the viewer control, the subreport shows up. The only thing really odd about this subreport, that I can think of, is that I feed it a SQLQuery. The subreport works fine in preview though, so I'm leaning towards something to do with my exportoptions object. Should I do anything special for the subreport's exportoptions that I'm not doing?


Code is as Follows:

'Crystal Report Object variables
Dim crxApp As CRAXDRT.Application
Dim crxReport As CRAXDRT.Report
Dim crxSubReport As CRAXDRT.Report
Dim crxSubReport2 As CRAXDRT.Report
Dim crxSubParam As CRAXDRT.ParameterFieldDefinition
Dim crxExpOptions As CRAXDRT.ExportOptions
Dim crxTable As CRAXDRT.DatabaseTable
strReport = strReportAllDocLocation
'Create and Use Crystal Objects
Set crxReport = crxApp.OpenReport(strReport, 1)
'We have to do this for the PO breakdown. Stored procedure killed crystal.
Set crxSubReport = crxReport.OpenSubreport("PO BreakDown")
Set crxSubParam = crxSubReport.ParameterFields.Item(1)
Set crxSubReport2 = crxReport.OpenSubreport("Shipping Instructions")
Set crxExpOptions = crxReport.ExportOptions

'We iterate through the tables stored in the report (and subreports) to set the login info.
For Each crxTable In crxReport.Database.Tables
crxTable.SetLogOnInfo strSQLSERVER, strDBName, strSQLID, strSQLPASS
Next

crxReport.DiscardSavedData
crxSubReport.DiscardSavedData
crxReport.RecordSelectionFormula = "{IPOXMIT.PONUM} = '" & CurrentPO & "'"

'This is the subreport for the PO breakdown utility.
crxSubParam.AddCurrentValue CurrentPO
crxSubReport.EnableParameterPrompting = False
crxSubReport.SQLQueryString = strSQLString
crxExpOptions.DestinationType = crEDTDiskFile
crxExpOptions.FormatType = crEFTPortableDocFormat
crxExpOptions.PDFExportAllPages = True
strDestination = ExportFolder & Trim(lstItem.Text) & ".pdf"
crxExpOptions.DiskFileName = strDestination
crxReport.DisplayProgressDialog = False
crxReport.Export False
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top