Click here to Skip to main content
11,721,385 members (84,637 online)
Rate this: bad
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 21:06pm
Edited 13-May-12 21:10pm
ShaikhM at 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 at 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
0 Sergey Alexandrovich Kryukov 510
1 OriginalGriff 249
2 Mika Wendelius 170
3 F-ES Sitecore 80
4 cyycoish 70
0 Sergey Alexandrovich Kryukov 2,209
1 OriginalGriff 969
2 F-ES Sitecore 660
3 Maciej Los 609
4 Richard MacCutchan 560

Advertise | Privacy | Mobile
Web03 | 2.8.150901.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