Click here to Skip to main content
15,904,655 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi
I have a vb6 application to export a particular crystal to a pdf format. I Wrote the following code in button click event.

VB
Dim crxApplication As CRAXDDRT.Application
Dim oReport As CRAXDDRT.Report
Dim crxExportOptions As CRAXDDRT.ExportOptions
Dim myDatabase As String

Set crxApplication = New CRAXDDRT.Application
Dim crxTable As CRAXDDRT.DatabaseTable

Set oReport = crxApplication.OpenReport(App.Path & "\sample.rpt", 1)
oReport.FieldMappingType = crAutoFieldMapping
For Each crxTable In oReport.Database.Tables
    crxTable.SetLogOnInfo servername, Database, userid, password
Next

Set crxExportOptions = oReport.ExportOptions
crxExportOptions.DestinationType = crEDTDiskFile
crxExportOptions.DiskFileName = App.Path & "\MyReport.pdf"
crxExportOptions.FormatType = crEFTPortableDocFormat
crxExportOptions.PDFFirstPageNumber = 1
crxExportOptions.PDFLastPageNumber = 1
crxExportOptions.PDFExportAllPages = True
oReport.Export False


It works fine. but while i click the button the following warning message occurs.
The database file "tablename" has changed. Proceeding to fix up the report!
I verified the crystal report and save it. While directly open crystal report file it works finely. please help to overcome this warning

[edit]Spurious tags removed, title, code block added - OriginalGriff[/edit]
Posted
Updated 13-May-12 21:10pm
v2
Comments
ShaikhM 15-May-12 0:00am    
What happens when you try to export the report to PDF from Crystal report itself? Any error?
Also does any part of your code adds or changes any fields from the "tablename" at runtime?
As an alternative try running a different dummy report that uses the same "tablename"
Kschuler 15-May-12 11:48am    
What version of Crystal Reports are you using?

1 solution

Please open report in crystal report designer and verify database from menu. Please check it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900