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

Crystal Report Error 1

Status
Not open for further replies.

atruhoo

Programmer
Jan 8, 2003
131
US
Trying to add Crystal Report created in CR 8.5 to VB6 app and keep getting error that "Server has not yet been opened"
Saw a previous thread (April 2004)that mentioned that should set locations tried that and still getting error. I have other reports that I created in same VB6 app that display properly. Assuming it has something to do with the fact that report was created in Crystal and then added into VB6, but not sure. Any suggestions would be greatly appreciated.

Here is the code I am using this works, but when change to CrystalReport5 or any new report added I get above error.

Dim crxRep As New CrystalReport3
Dim oraRst As Recordset

Dim Sql As String
Dim strStatus As String


Private Sub Form_Load()
strStatus = "Active"
Set oraRst = New ADODB.Recordset

Sql = "Select Last_Name, First_Name, Lot_Name, Card.Card_Num " & _
"From Emp, HR_VIEW, Card, ParkingLot " & _
"Where Emp.Emp_ID = HR_VIEW.EMP_ID " & _
"and Emp.Card_Num = Card.Card_Num " & _
"and Card.Lot_ID=ParkingLot.Lot_ID " & _
"and Emp.Status = '" & strStatus & "' " & _
"Order By Lot_Name, Card_Num "


oraRst.ActiveConnection = G_OraConn
oraRst.LockType = adLockReadOnly

oraRst.Open Sql

crxRep.Database.SetDataSource oraRst
CRViewer1.ReportSource = crxRep
CRViewer1.ViewReport

End Sub

Private Sub Form_Resize()
SortedParking.WindowState = vbMaximized
With CRViewer1
.Top = 0
.Left = 0
.Width = ScaleWidth
.Height = ScaleHeight
.Zoom 100
End With

End Sub

Richard
 
Could be that the report was created using a driver other than pdsmon.dll (the Active Data driver) to access the database. To find out what driver the report is using, open up CrystalReport5.Dsr in the Designer Component, right click > Database > Convert Database Driver. The "From:" part will be grayed out, but it'll show what driver it's using. If it's something other than "pdsmon.dll" or "p2smon.dll", then that's the problem.

Here's a whitepaper on this:

-dave
 
You were dead on about the Active Data driver. Was using pdsoledb.dll. Assume Crystal made this choice since used OLE Db for Oracle and then selected fields from tables selected. When I attempted to convert got an error that something wasn't supported and VB6 shut down. I am assuming that this occured because didn't use SQL statement to create original report in CR 8.5. Is this an issue when you create reports in Crystal and then try to add to VB app. Normally create reports using Crytal in Visual Studio, but tried something different and wondering if this will be an ongoing problem if continue to try this or is there some way I can avoid.

Giving you a star for your tip, but hope you or someone else can add more so I get a better grip on this as I am pretty new to using Crystal Reports within my apps.
 
If you want to create reports in the Crystal Reports designer as opposed to within the VB IDE, you should always use Active Data as your data source if you're planning to pass a recordset to the report from your application.

Probably the most common method of setting up a report to use active data is by using TTX files. Here's a pretty thorough document on how to create and use them:

-dave
 
have a look at the LogonServer method. You need to call it for each table in your report.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top