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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal 8.5 and VB 6, "Server has not yet been opened" error 1

Status
Not open for further replies.

JBGallagher

Programmer
Mar 30, 2004
5
CA
I am running VB 6 and Crystal Reports 8.5 with an Access database. I have created a simple report that does not save the data when run. I want the data to refresh every time you open it. I added the report to my VB app as an existing reprot that should show in a CRViewer control.

This is the code:

Dim Report As New CrystalReport1

Private Sub Form_Load()
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub

When I step throught this report source is allways = Nothing
When the CRViewer1.ViewReport line executes I get the "Server has not yet been opened" error.

This is a very simple DB, there is no password, or username required. I have been using ADO to connect to the database for inserts, updates and selects.

The report will run no problem in the Crystal interface.

Any help would be great.

Thanks
 
I think, checking the property CRViewer1.IsBusy can help you.

I guess, you have some events handlings inside your report design object.
So, may be, you need the check this property in order to know if you can proceed these events or wait for server to product current report page...

Hope it will help you.
 
Is that everything? I don't see where you've set up the report file, etc. in the Report object.

"I think we're all Bozos on this bus!" - Firesign Theatre [jester]
 
I get the same error on one of my reports...(note it is one report out of round about 60)

I've gotten to think it is question of "bad data" ... or some kind of character in the fields that I'm reading that Crystal can't handle.

I was standing in the park, wondering why frisbees got bigger as they came closer... then it hit me!
 
Thanks for the replies guys. I'm going to try Giordano's idea.

That is pretty much all the code. The report was set up in the Crystal Editor, not at run time.
 
I have tried Giordano's idea, the CRViewer1.IsBusy check returns true. It is busy. That's great, but what can I do about it. I tried putting a DoEvents just before the assignment of CRViewer1.ReportSource = Report, and I still get the error. I'm really at a loss here guys.

The report itself was created using Crystal, in the Crystal Designer in VB I selected to use an existing report. When I run the report outside of my program in works fine. I've had no problem with data.
 
How is the report connecting to the Access db (ODBC, etc.)?

Here are a few things that would generate that message when connecting to an Access db:

1) there's a password on the db
2) the report is expecting a recordset to be passed
3) the report uses an ODBC data source that's not set up correctly on the client.

-dave
 
Thanks for the ideas vidru.

When I created the report in Crystal, I selected a database file as the Data source. In this case I selected the DBName.mdb file, then the specific table I am using for the report. This is a very simple database, there is only one table.

So...
1) There is no password
2) The report shouldn't be expecting a recordset, as it was set up in Crystal, not VB and the report runs fine outside VB.
3) I'm not using ODBC at all. The VB program itself uses ADO, and the report connects directly to the database file as described above.

I recently changed my code to the following, after having looked at a project provided by Business Objects. I still get the same error. However if I run the sample project that shows how to connect to a report using ADO it works fine. So I have no idea what is wrong here.

Dim Report As New CrystalReport1
Dim datcmd1 As ADODB.Command
Dim fld As FieldObject

Private Sub Form_Load()
If Connection.State <> adStateOpen Then
Connection.Open
End If
'Create a new instance of the ADO Command object
Set datcmd1 = New ADODB.Command
Set datcmd1.ActiveConnection = Connection
datcmd1.CommandText = "tblTurnover"
datcmd1.CommandType = adCmdTable
'Add the datasource to the report
Report.Database.AddADOCommand Connection, datcmd1
'Load the report
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
 
Try this...

In VB, open up your CrystalReport1 designer form. Right click on Database Fields > click Set Location. Click the Set Location button, and go through the same steps you used to originally create the report (Database Files > Find Database File > etc.).

-dave
 
Glad I could help, JB.

And thanks for the love.

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top