Run-time error '91'
Object variable or with block variable not set
I get the above error message on this line of code
Set CrRep = CrAppl.OpenReport(file path as string)
If anyone could help it would be greatly appreciated.
The entire program is listed below:
Private Sub Form_Load()
Dim CrAppl As CRAXDRT.Application
Dim CrRep As CRAXDRT.Report
Dim AdoRs As ADODB.Recordset
Dim dbConn As ADODB.Connection
GetProgramRights
InitConnection "infodesk-master", dbConn
''open the ADO recordset
'InitRecordset dbConn, AdoRs, "SELECT [infodesk-ba_desk].dbo.Account.*, Workers.FName + ' ' + Workers.LName AS Name FROM [infodesk-ba_desk].dbo.Account INNER JOIN [InfoDesk-Master].dbo.Workers Workers ON [infodesk-ba_desk].dbo.Account.WorkerIn = Workers.WorkerNo ORDER BY [infodesk-ba_desk].dbo.Account.RecDate"
'Open the ADO recordset
InitRecordset dbConn, AdoRs, "SELECT [infodesk-ba_desk].dbo.Account.*, Workers.FName + ' ' + Workers.LName AS Name FROM [infodesk-ba_desk].dbo.Account INNER JOIN [InfoDesk-Master].dbo.Workers Workers ON [infodesk-ba_desk].dbo.Account.WorkerIn = Workers.WorkerNo ORDER BY [infodesk-ba_desk].dbo.Account.RecDate"
'Open the report
Set CrRep = CrAppl.OpenReport(file path as string)
'This sets our ADO recordset to the first table in the
'report
CrRep.Database.Tables(1).SetDataSource AdoRs, 3
'Set the report source of the Crviewer control to our
'report object.
CRViewer1.ReportSource = CrRep
'Tell viewer control to process and preview the report
CRViewer1.ViewReport
End Sub
Private Sub Form_Resize()
'Resize the Crystal Viewer if Form1 is resized
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Width = Form1.Width - 200
CRViewer1.Height = Form1.Height - 400
End Sub
Object variable or with block variable not set
I get the above error message on this line of code
Set CrRep = CrAppl.OpenReport(file path as string)
If anyone could help it would be greatly appreciated.
The entire program is listed below:
Private Sub Form_Load()
Dim CrAppl As CRAXDRT.Application
Dim CrRep As CRAXDRT.Report
Dim AdoRs As ADODB.Recordset
Dim dbConn As ADODB.Connection
GetProgramRights
InitConnection "infodesk-master", dbConn
''open the ADO recordset
'InitRecordset dbConn, AdoRs, "SELECT [infodesk-ba_desk].dbo.Account.*, Workers.FName + ' ' + Workers.LName AS Name FROM [infodesk-ba_desk].dbo.Account INNER JOIN [InfoDesk-Master].dbo.Workers Workers ON [infodesk-ba_desk].dbo.Account.WorkerIn = Workers.WorkerNo ORDER BY [infodesk-ba_desk].dbo.Account.RecDate"
'Open the ADO recordset
InitRecordset dbConn, AdoRs, "SELECT [infodesk-ba_desk].dbo.Account.*, Workers.FName + ' ' + Workers.LName AS Name FROM [infodesk-ba_desk].dbo.Account INNER JOIN [InfoDesk-Master].dbo.Workers Workers ON [infodesk-ba_desk].dbo.Account.WorkerIn = Workers.WorkerNo ORDER BY [infodesk-ba_desk].dbo.Account.RecDate"
'Open the report
Set CrRep = CrAppl.OpenReport(file path as string)
'This sets our ADO recordset to the first table in the
'report
CrRep.Database.Tables(1).SetDataSource AdoRs, 3
'Set the report source of the Crviewer control to our
'report object.
CRViewer1.ReportSource = CrRep
'Tell viewer control to process and preview the report
CRViewer1.ViewReport
End Sub
Private Sub Form_Resize()
'Resize the Crystal Viewer if Form1 is resized
CRViewer1.Top = 0
CRViewer1.Left = 0
CRViewer1.Width = Form1.Width - 200
CRViewer1.Height = Form1.Height - 400
End Sub