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

Exporting to PDF from VB6 using Crystal Report control

Status
Not open for further replies.

yurok

Programmer
Oct 13, 2004
14
US
Hey everybody,
I was using Crystal Report control in VB6 applications which allows to export to PDF provided that DLLs are installed on the client machines or the server the applications runs from
I need to be able to do it from code and that is the one I am trying to use:

Set appl = New CRAXDRT.Application
Dim rep As CRAXDRT.Report
Dim crxTable As CRAXDRT.DatabaseTable

Set rep = appl.OpenReport(CrystalReport1.ReportFileName, 1)

rep.ExportOptions.FormatType = crEFTPortableDocFormat
rep.ExportOptions.DestinationType = 1
rep.ExportOptions.DiskFileName = "c:\Test.PDF"
rep.Export False


It all works fine(I check in Immediate Window it finds the report with all the data) till the last line
There it gives an error message:

2147192184(80047288)
"Server has not yet been opened"

I have tried different approaches including using
LogOnToServer method:

rep.Database.LogOnServer "P2SSQL.DLL", "S600Q24", Mydb,MyUserName,MyPassword

It logs on to the server but the error still occurs on Export line


Any ideas on that will be greatly appreciated.

Cheers!
 
Does the report have subreports? You need to log on to the server for each table in the main report and the subreports.

What version are you using? The Data connection code is different for each version.

Editor and Publisher of Crystal Clear
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top