Crystal Decisions has a document that discusses this error message at
http://support.crystaldecisions.com/communityCS/TechnicalPapers/cr_server_not_yet_been_opened.pdf.aspOne other thing I see here. Why are you using a DSN? If you supply a DSN to ADO, it will access the data through an ODBC driver, adding overhead that is not needed. You should supply an ADO connection string.
>Option Explicit
>Dim CRApp As CRAXDDRT.Application
>Dim Rpt As CRAXDDRT.Report
>Dim cn As Connection
>Dim rs As RecordSet
>
>Private Sub Form_Load()
> Set cn = New Connection
> cn.CursorLocation = adUseClient
> cn.Open "dsn=SQLServer","sa"
>
> Set rs = New Recordset
> rs.Open "Select * from Banks where Branch='Area 5'", cn, adOpenKeyset, adLockBatchOptimistic
>
> Set CRApp = New CRAXDDRT.Application
>
> Set Rpt = CRApp.OpenReport(App.Path & "\Report1.rpt")
> Rpt.DiscardSavedData
>
> Rpt.Database.SetDataSource rs
>
> crv.ReportSource = Rpt
> crv.ViewReport
>End Sub
>
>I made a sample form with the CRViewer object. When I run this simple code, I get a "SERVER HAS NOT YET BEEN OPENNED" error. I checked the state of the connection object... it is ok. I cheched the recordset state and contents... they're all ok. I cheched the SQL server and it is working fine. I've been trying to figure this out for two weeks now and I can't figure out what is wrong... HELP ME PLEASE!!!
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer