Skip to Content
0

Export Report from Access 2010 64bit

Dec 07, 2016 at 04:30 PM

29

avatar image

Dear All,

I use the following code to export the report to PDF and it is working in MS access 32bit but when I tried to run it in the 64bit I get error #420 "ActiveX component can't create object". I registered the lib "CRAXDRT.dll" and still have the same error. Please hepl me.

Public Const REPORT_LOC As String = "D:\Report.rpt"
Public Sub GenerateLocalRepReport2()
    Dim crystalApp As New CRAXDRT.Application
    Dim crxTable As CRAXDRT.DatabaseTable
    Dim crystalReport As New CRAXDRT.Report
    Dim exportOpts As ExportOptions
    
    Set crystalReport = crystalApp.OpenReport(REPORT_LOC)
    crystalReport.DiscardSavedData
    
    On Error GoTo BadCrystalConnection
    For Each crxTable In crystalReport.Database.Tables
        crxTable.ConnectionProperties.DeleteAll
        crxTable.ConnectionProperties.Add "DSN", "XYZ"
        crxTable.ConnectionProperties.Add "Database", "XYZ"
        crxTable.ConnectionProperties.Add "User ID", "sa"
        crxTable.ConnectionProperties.Add "Password", "sa"      
        crxTable.Location = crxTable.Location

    Next crxTable
    On Error GoTo 0
     
    crystalReport.ParameterFields(1).AddCurrentValue "A2002"    
    'exportOpts = New Report.ExportOptions
    crystalReport.ExportOptions.FormatType = crEFTPortableDocFormat
    crystalReport.ExportOptions.DiskFileName = "D:\Report_1.pdf"
    crystalReport.ExportOptions.DestinationType = crEDTDiskFile
    crystalReport.Export False
    
    Exit Sub
    
BadCrystalConnection:
MsgBox "The DSN connection string for Crystal Reports is invalid"

End Sub
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Don Williams
Dec 07, 2016 at 04:31 PM
0

The RDC component is only available in 32 bit. It's also no longer supported, ended with CR XI R2 ( 11.5 )

To upgrade you need to move to CR for .NET which can be downloaded from here:

https://blogs.sap.com/2016/12/06/sap-crystal-reports-developer-version-for-microsoft-visual-studio-updates-runtime-downloads/

Don

Share
10 |10000 characters needed characters left characters exceeded