×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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!
  • Students Click Here

*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

ERROR : Server has not yet been opened!

ERROR : Server has not yet been opened!

ERROR : Server has not yet been opened!

(OP)
Hi,

I am trying to export a report without using the designer, or any viewers on my form...

I simply want to export it out to PDF format.

It gives me the Error Message (Server has not yet been opened)

I must be missing out something... but what??

I would apriacate some help, this is getting quite urgent

Thanks

Ian

(please see below my entire code for trying to export a report)


Dim CrystalApp As New CRAXDRT.Application
Public Report As CRAXDRT.Report

Private Sub Form_load()
    Dim ExportOpts As CRAXDRT.ExportOptions
    
    Set Report = CrystalApp.OpenReport("c:\Report3b.rpt", 1)
    
    Report.Database.LogOnServer "pdsodbc.dll", "testdb"
    
    Set ExportOpts = Report.ExportOptions
    
    With ExportOpts
        .FormatType = crEFTPortableDocFormat
        .DestinationType = crEDTDiskFile
        .DiskFileName = "C:\windows\desktop\ExpTest.pdf"
    End With
    
    Report.Export False
    
End Sub

RE: ERROR : Server has not yet been opened!

a) Nowhere near enough parameters
b) Wrong DLL - use "p2" not "pd"  - pd are the 16-bit DLLs; don't ever use them

Report.Database.LogOnServer "p2sodbc.dll", "testdb", p3, p4, p5

If "testdb" is an ODBC DSN, just put a comma for p3.  If "testdb" is a server name, p3 is the database name.  p4 and p5 are the username and password to login to the database.

RE: ERROR : Server has not yet been opened!

(OP)
Thanks balves,

I've replaced the DLL, so it now looks at "p2sodbc.dll".

Testdb is indeed my ODBC DSN, it still does'nt work.

I am using a windows authentication so no username or password is required... what am i doing wrong.????

is there any other way to connect?

i've tried Report.Database.Verify????

Thanks

Ian

RE: ERROR : Server has not yet been opened!

Use the SetLogonInfo of the Table object instead. It is much more stable than the LogonServer method. Use the following code:

Dim i as integer

For i = 1 to Report.Database.Tables.Count
  Report.Database.Tables(i).SetLogonInfo "","","","Password"
Next

RE: ERROR : Server has not yet been opened!

Some people do find .SetLogonInfo more reliable.  It's the same parameter list, except the first one (DLL) is not used.

Report.Database.Tables(1).SetLogonInfo "DSN",, "user", "pwd"

Some people claim that the DSN is case-sensitive.  I don't think so, but it cannot hurt.

Don't know about leaving the username and password parameters if you use Windows Authentication.

RE: ERROR : Server has not yet been opened!

(OP)
Thanks Guys,

I've sorted it now.

something silly....

I copied the report from an old archive (for testing) and forgot to convert the database to ODBC, i was still using the SQL server driver....

The DLL info was useful though, thanx Balves.

Cheers

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