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!!!
Shit happens!!!