Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ERROR : Server has not yet been opened!

Status
Not open for further replies.

IanNav

Programmer
Feb 26, 2001
79
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
 
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.
 
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

 
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

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

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top