Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 7th, 2008, 09:46 AM
Registered User
 
Join Date: Feb 2008
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default CRD vba code no longer works

I use the crystal report designer i to export a crystal report as a tab separated text from Microsoft Access. The report was originally written in Crystal 8.5 and connected to the Oracle back end database via ODBC.

This code worked:

Public Function ExportCrystalReport(strReportLocation As String, _
                                    strReportFileName As String, _
                                    strExportLocation As String, _
                                    strExportFileName As String, _
                                    Optional intParameterValue As Integer = 0) As Boolean

Dim crxApp As New CRAXDRT.Application
Dim crxReport As CRAXDRT.Report
Dim crxParameter As CRAXDRT.ParameterFieldDefinition

On Error GoTo ErrHandler

    Set crxReport = crxApp.OpenReport(strReportLocation & strReportFileName)

    crxApp.LogOnServer "pdsora7.dll", "EMS", , "XXXX", "xxxx"

    With crxReport
        With .ExportOptions
            .DiskFileName = strExportLocation & strExportFileName
            .DestinationType = crEDTDiskFile
            .FormatType = crEFTTabSeparatedText
        End With

        If intParameterValue = 0 Then
        Else
            Debug.Print .ParameterFields.Count
            Debug.Print .ParameterFields.Item(1).Name
            .ParameterFields.Item(1).AddCurrentValue intParameterValue
        End If

        'Don't prompt for export options
        .Export False
    End With

    Set crxReport = Nothing

    crxApp.LogOffServer "pdsora7.dll", "EMS", , "XXXX", "xxx"

    Set crxApp = Nothing
    ExportCrystalReport = True

CleanUp:
    Exit Function

ErrHandler:
    ExportCrystalReport = False
    MsgBox "Error whilst exporting the report " & strReportFileName, vbCritical

End Function

However, we have since upgraded to crystal 10 standard edition so the ODBC link is no longer available. The report now connects using the Microsoft OLEDB provider for Oracle. I've changed the references in Access so that the "Crystal reports ActiveX Designer Run time Library 10.0" is referenced rather than the 8.5 version. I've also changed the log on server command so that it uses the P2Soledb.dll to connect to the database. This appears to be ok as I can view details about the report (eg crxreport.ReportAuthor) but I now get an error at the ".Export false" line.

Anyone got any ideas? Am I using the correct logonserver line?

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code works in Excel VBA but not Access VBA fossx Access VBA 2 May 21st, 2007 08:00 AM
Code that works !! for chapter 3 dawsonje44 BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 March 2nd, 2007 04:33 PM
Wrox Press C++ Tutorial no longer works bruce_x15 Visual C++ 3 June 19th, 2006 03:37 PM
PHP code - works in Firefox, fails in IE gingerbraid Beginning PHP 13 October 6th, 2005 06:33 PM
code works in IE but not netscape Toka1 Javascript How-To 2 November 27th, 2003 05:35 AM



All times are GMT -4. The time now is 11:18 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.