|
-
May 10th, 2001, 01:36 PM
#1
Thread Starter
Addicted Member
server has not been opened yet
This is my code for using the crview for crystal reports from vb. On the highlighted line, the program gives me the error that "Server has not yet been opened". What is causing this error?
Option Explicit
Public reportToView As CRAXDRT.Report
Public subReportToView As CRAXDRT.Report
Public reportApp As New CRAXDRT.Application
Public params As CRAXDRT.ParameterFieldDefinitions
Public param As CRAXDRT.ParameterFieldDefinition
Public parameters As CRAXDRT.ParameterFieldDefinitions
Public parameter As CRAXDRT.ParameterFieldDefinition
Dim CurrentReportPath As String
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim strFullName As String
Dim temp As String
Private Sub Form_Load()
cnn.Open "Driver={SQL Server};Server=Brick;Database=ATM_Information;Uid=sa;Pwd=;"
rst.Open "SELECT firstname,lastname FROM LogInRights " & _
"WHERE signon = '" & strUserName & "';", cnn, adOpenKeyset, adLockOptimistic
strFullName = rst!firstname + " " + rst!lastname
rst.Close
cnn.Close
Set reportToView = reportApp.OpenReport("I:\ATM Project\atmcashfunding.rpt")
reportToView.EnableParameterPrompting = False
reportToView.ReadRecords
Set params = reportToView.ParameterFields
Set parameters = reportToView.ParameterFields
For Each param In params
With param
.ClearCurrentValueAndRange
If .Name = "{?OrderDate}" Then
.AddCurrentValue CDate(Format(sOrderDate, "dd-mmm-yyyy"))
End If
If .Name = "{?ATMID}" Then
.AddCurrentValue sOrderATMID
End If
If .Name = "{?UserName}" Then
.AddCurrentValue strFullName
End If
End With
Next
With CRViewer1
.ReportSource = reportToView
If strCashOrder = "Preview" Then
.ViewReport
Else
.ViewReport
temp = MsgBox("Waiting for report data to be loaded.", vbOKOnly, "Wait")
.PrintReport
temp = MsgBox("Report has been sent to the printer.", vbOKOnly, "Sent to Printer")
End If
End With
CRViewer1.DisplayGroupTree = True
CRViewer1.EnableGroupTree = False
CRViewer1.EnableRefreshButton = False
End Sub
Normal is boring...
 smh 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|