Results 1 to 5 of 5

Thread: Export crystal report + oracle database in VB

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    3

    Export crystal report + oracle database in VB

    I create one standard exe file.

    Then I add in a crystal report file with
    oracle ODBC connection named as CrystalReport1
    Together I add a crystal report viewer.

    When I run the program, I got this error
    "Server has not yet been opened"

    This is the command to export the report out to pdf.

    Private Sub Command1_Click()
    Dim Report As New CrystalReport1
    filedb = App.Path

    With Report
    .ExportOptions.ODBCDataSourceName = "DSNname"
    .ExportOptions.ODBCDataSourceUserID = "Username"
    .ExportOptions.ODBCDataSourcePassword = "Password"
    .ExportOptions.FormatType = crEFTPortableDocFormat
    .ExportOptions.DestinationType = crEDTDiskFile
    .ExportOptions.DiskFileName = filedb & "VehicleExp.pdf"
    .Export False
    End With

    End Sub
    ---------------------------------------

    anybody please help me to solve this problem..
    thanks

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Export crystal report + oracle database in VB

    Welcome to the Forums.

    "Server has not yet been opened" error usually meand that you havent
    properly opened the report with the correct credientials. Try checking out
    the Report.Database.Tables(1).SetLogOnInfo sServer, sDatabase, sUserName,
    sUserPwd before you open yuor report.

    Also, here is a link to one of my examples for using an ADO rs with the CR
    Viewer Control.

    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    3

    Re: Export crystal report + oracle database in VB

    I still having a problem if using the above solution because my report are
    using Oracle Database.

    Now im using CrystalReport object to export and it was OK.
    Below is my code. Just one problem, when i export to RTF, how to bypass dialog box that ask for the Page Range? I want it to export all page.

    Private Sub RouteWOAgingReport()

    dtFrom = "01/" & strMth & "/" & strYear
    dtTo = "23/" & strMth & "/" & strYear

    With rptReport
    .Connect = "DSN=PROD;UID=Username;PWD=Password;"
    .ReportFileName = App.Path & "\" & "rptRouteWOAging.rpt"
    .ParameterFields(0) = "DateFrom;" & dtFrom & ";true;"
    .ParameterFields(1) = "DateTo;" & dtTo & ";true;"
    .ParameterFields(2) = "UnitOffice;" & strUnitOffice & ";true"
    .PrintFileType = crptRTF
    .PrintFileName = Filedb & "\" & "Route WO Aging.rtf"
    .Destination = crptToFile
    .ProgressDialog = False
    .PrintReport
    End With

    strReportName = "Route WO Aging.xls"
    SendEmail (strReportName)

    End Sub
    Last edited by g--mey; Feb 15th, 2005 at 08:26 PM.

  4. #4

    Thread Starter
    New Member
    Join Date
    Feb 2005
    Posts
    3

    Re: Export crystal report + oracle database in VB

    Bump...

    somebody please help..

    thanks..

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Export crystal report + oracle database in VB

    Here is one of my examples on export CR. You need to add the reference for exporting and use the .ExportOptions object.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width