Link to home
Start Free TrialLog in
Avatar of DSmith1965
DSmith1965

asked on

Server Has Not Yet Opened

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
   ctlCRViewer.ViewReport
Avatar of Robberbaron (robr)
Robberbaron (robr)
Flag of Australia image

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...

 
Avatar of DSmith1965
DSmith1965

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Robberbaron (robr)
Robberbaron (robr)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.

Don