×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Runtime error 91

Runtime error 91

Runtime error 91

(OP)
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

RE: Runtime error 91

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.

RE: Runtime error 91

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close