Hi
From looking at various posts here and elsewhere I have managed to create a form containing the Crystal Report Viewer Control 9.0 Active X and a command button with the undernoted code.
This allows me to open the report in the viewer with no problems. But if I try to refresh the data then I get the error,
Logon Failed.
Logon Failed for User 'SA'.
I know that I need to set the connection properties but I don't know how to go about doing this.
Can anyone help me.
Thanks
JC
From looking at various posts here and elsewhere I have managed to create a form containing the Crystal Report Viewer Control 9.0 Active X and a command button with the undernoted code.
Option Compare Database
Option Explicit
Public CRReport As CRAXDRT.Report
Public CRApplication As New CRAXDRT.Application
Public ReportLoc As String
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
ReportLoc = "filelocation"
Set CRReport = CRApplication.OpenReport(ReportLoc)
CRReport.ReadRecords
Me!crtest.ReportSource = CRReport
Me!crtest.ViewReport
While Me!crtest.IsBusy
DoEvents
Wend
Exit_Command0_Click:
Exit Sub
Err_Command0_Click:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_Command0_Click
End Sub
This allows me to open the report in the viewer with no problems. But if I try to refresh the data then I get the error,
Logon Failed.
Logon Failed for User 'SA'.
I know that I need to set the connection properties but I don't know how to go about doing this.
Can anyone help me.
Thanks
JC