Click here to Skip to main content
11,640,125 members (69,226 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 Suvendu Shekhar Giri 225
1 F-ES Sitecore 170
2 CPallini 167
3 Sergey Alexandrovich Kryukov 144
4 himanshu agarwal 142
0 OriginalGriff 9,081
1 Sergey Alexandrovich Kryukov 8,847
2 Mika Wendelius 7,027
3 Suvendu Shekhar Giri 2,650
4 F-ES Sitecore 2,558

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