Click here to Skip to main content
11,926,805 members (54,453 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB6 PDF CrystalReports

I have a vb6 application to export a particular crystal to a pdf format. I Wrote the following code in button click event.

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
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 13-May-12 22:06pm
Edited 13-May-12 22:10pm
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

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web03 | 2.8.151126.1 | Last Updated 22 May 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100