Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Server has not yet been opened.

Server has not yet been opened.

Server has not yet been opened.

I am trying to write a generic VB application to display Crystal reports with parameters.  I can get it to display the a report with stored data but get "Server has not yet been opened" when I resubmit the report.  I am using RDC.  I have looked at the Automation Server but this requires additional coding to pass the parameters to the reports.  Do I have to use the Automation Server to accomplish this?

Option Explicit
Dim m_Application As New CRAXDDRT.Application
Dim m_Report As New CRAXDDRT.Report
'Dim m_Application As New CRPEAuto.Application
'Dim m_Report As New CRPEAuto.Report
'Dim m_Report As New CrystalReport1
Dim datacmd1 As ADODB.Command
Dim i As Integer

'DisplayReport is a procedure that
' - Sets the report object to the Crystal Report Viewer Control
Public Sub DisplayReport()
    Screen.MousePointer = vbHourglass
    CRViewer1.ReportSource = m_Report
    ' Set the viewer to view the report
    ' Set the zoom level to fit the page
    ' to the width of the viewer window
    CRViewer1.Zoom 1
    Screen.MousePointer = vbDefault
End Sub

Private Sub cmdOpenReport_Click()
    CommonDialog1.CancelError = True
    On Error GoTo errHandler
    'Display the open dialog box
    ' Build the ADO connection string
    'strConnectString = "Provider=MSDAORA;Data Source=prod" + _
     '   ";User ID=userid;Password=password"
    'If OpenConnection() = False Then
    '    MsgBox "Unable to Logon", , "Logon Failed"
    'End If
    'Set the report object to nothing
    Set m_Report = Nothing
    'Set m_Application = CreateObject("Crystal.CRPE.Application")
    'Open the selected report

    Set m_Report = m_Application.OpenReport(CommonDialog1.FileName, 1)
    'm_Report.Preview ("Hercules")
   ' m_Report.Database.Tables(1).SetDataSource rsRecordSet, 3

    'm_Report.Database.Tables(1).SetLogOnInfo "", "", "", "userPassword"
    'm_Report.Database.Tables(1).SetLogOnInfo "lawsonprod", "prod", "userid", "password"
    'm_Report.Database.LogOnServer "pdsodbc.dll", "prod.world", "prod", "Lawsonprod", "Mustangs"

    Call DisplayReport
    Set m_Report = Nothing
    Set m_Application = Nothing
    Exit Sub
    'User cancalled dialog
End Sub

RE: Server has not yet been opened.

Remove the CRPEAuto references.  Choose one method to connect to the database, either .SetLogonInfo or .LogonServer (right now they are both commented out).   

For .LogonServer:

m_Report.Database.LogOnServer "p2sodbc.dll", "prod.world", "prod", "Lawsonprod", "Mustangs"

I use p2sodbc.dll.
prod.world is the DSN or server name.
prod is the name of the db.
Lawsonprod is the username and Mustangs is the password.

Brian J. Alves
Terrier Consulting, Inc.
Email: brian.alves@worldnet.att.net
VB / Crystal / SQLServer

RE: Server has not yet been opened.

Thank you for the information.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close