• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

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
0
DSmith1965
Asked:
DSmith1965
  • 2
  • 2
1 Solution
 
Robberbaron (robr)Commented:
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...

 
0
 
DSmith1965Author Commented:
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.
0
 
Robberbaron (robr)Commented:
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.....
0
 
DSmith1965Author Commented:
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
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now