Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime error 91

Status
Not open for further replies.

Joe123123

Programmer
Mar 27, 2003
1
0
0
US
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
 
Joe, You are in the wrong forum. This forum is for Seagate Info. You probably won't get much useful help here. Try one of the Crystal Decisions: Crystal Reports forums, there are four (4) of them, in this case I thint you should try number 3 Integrate[\b].

Good luck.
 
Hi,

Dim CrAppl As CRAXDRT.Application
Dim CrRep As CRAXDRT.Report

<Set CrRep = CrAppl.OpenReport(file path as string)

The problem is that you haven't created the CrAppl object
yet.

Regards,

Gavin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top