Server Has Not Yet Opened

Posted on 2007-08-06
Last Modified: 2013-12-26
I have a report that I want to run against different identical databases.  The report was created in crystal 8.5, and I am using a viewer created in VB6 to view the reports.  Because it is an old app, and I need to do this quick upgrading it to .net is not an option right now.  When I run the viewer it works fine and the report displays.  But, when I run the viewer pointing to the second database I get the Server Has Not Yet Opened error.  I'm also running against a SQL server.  When it logs onto the tables it loops the correct number of times so I know part of it is working.

Below is my code and it is in a private sub routine.
   Dim crxApplication As New CRAXDRT.Application
   Dim crxReport As New CRAXDRT.Report
   Dim crxDatabase As CRAXDRT.Database
   Dim crxDatabaseTables As CRAXDRT.DatabaseTables
   Dim crxDatabaseTable As CRAXDRT.DatabaseTable
   Dim crxApplication As
   On Error GoTo errorhandler
   ' Make the CRViewer visible
   ctlCRViewer.Visible = True
   'Set the report object
   Set crxReport = crxApplication.OpenReport(App.Path & "\chart.rpt")
   crxReport.Database.LogOnServer "p2ssql", "server", "database", "uid", "pwd"
   Set crxDatabase = crxReport.Database
   Set crxDatabaseTables = crxDatabase.Tables
   For Each crxDatabaseTable In crxDatabaseTables
    crxDatabaseTable.SetLogOnInfo "server", "database", "uid", "pwd"
  Next crxDatabaseTable
   crxReport.ParameterFields.GetItemByName("ENTERCONO").AddCurrentValue "12"
   crxReport.EnableParameterPrompting = False
   'Enables the CRViewer's Navigation Controls
   ctlCRViewer.EnableNavigationControls = True
   'Disables the CRViewer's Search control
   ctlCRViewer.EnableSearchControl = False
   'maximizes the window
   'Me.WindowState = 2
   'Set the report source
   ctlCRViewer.ReportSource = crxReport
   'View the report
Question by:DSmith1965
    LVL 32

    Expert Comment

    by:Robberbaron (robr)
    1/ are the 2 databases on the same server ?
    2/ on what line does it error ?
    is it <crxReport.ParameterFields.GetItemByName("ENTERCONO").AddCurrentValue "12">

    3/ i doubt it will help but to ease reading i try to use

         sMyServer = "server"
         sMyDB = "database"
         sMyUid = "uid"
         sMypwd ="pwd"
    crxReport.Database.LogOnServer "p2ssql", sMyserver, sMyDB, sMyuid, sMypwd

    that way the code is independent of the logons so we can see the code exactly as it will work...


    Author Comment

    1 - Both databases are on the same server
    2 -  The error occurs when the report goes to display, the viewer opens up and the message is there.
    3 - Tried that didn't seem to make a difference.
    LVL 32

    Accepted Solution

    do you have On error resume next set at all ?

    Is one of the DB actions failing but just moving to next statement ?

    clutching at straws.....

    Author Comment

    No, I have an on error goto, and it doesn't go to the sub routine.  I gave up and copied the reports to a directory with the same name as the dsn and so when the dsn is passed to the app the, the dsn is stored and used in the .openreport event as part of the path.  Thanks for your help, I'm going to give you partial points for responding.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
    Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now