[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3688
  • Last Modified:

VB 6.0, Run-time error 91 - Object variable or With block not set

I'm really stuck and I hope someone can point me in the right direction.

I have an existing VB, ASP application which is entirely interactive.  It is a web application in which the user directs what screens and reports are generated and the parameters for those reports.  Works great and is compiled as an ActiveX DLL.  I am trying to create a separate application which will run in a batch mode calling some of those reports.

To test this process, I am attempting to call a sub within a class.  It appears the object reference to the class is set correctly; however, I am not sure how to set the reference to the sub within the class.  I am getting the '91' error on the 'OpenRpt.msOpenOrderRecapReport' line.

I've researched other questions similar to this ...specifically one on this site with roughly the same subject.  I have verified only one DLL exists with this name.   Since the assignment of the class seems to work accurately, I'm wondering how I can execute a module within the class.  I appreciate any suggestions offered.  

New VB ~
*************************************************************************************************
  Dim OpenRpt As New clsOpenReport
  On Error GoTo ErrorHandler
 
  'Establish database connection
  DataEnvironment1.objConn.Open
     
  'Call the report
  Set OpenRpt = New clsOpenReport
   
  If Not IsObject(OpenRpt) Then
     MsgBox "Online dll not loaded properly"
     Exit Sub
  Else
     OpenRpt.msOpenOrderRecapReport
     MsgBox "Online dll referenced; module called"
  End If
   
  'Create PDF ....logic here
  'Insert into Inbox ....logic here
 
  'Close database connection
  DataEnvironment1.objConn.Close
  Close
Exit Sub
   
ErrorHandler:
     MsgBox "Error " & Err.Number & "- " & Err.Description & " Line: " & Erl
    Close
End Sub
*************************************************************************************************************

The class being referenced above is basically set up as follows ~
Option Explicit
Public Sub OnStartPage(objScriptingContext As ScriptingContext)
  'Set reference to the Web's ScriptingContext objects
  On Error Resume Next
  Set m_Application = objScriptingContext.Application
  Set m_Request = objScriptingContext.Request
  Set m_Response = objScriptingContext.Response
  Set m_Session = objScriptingContext.Session
  DataEnvironment1.objConn.Open
End Sub
Public Sub OnEndPage()
  'Set reference to the Web's ScriptingContext objects
  On Error Resume Next
  Set m_Application = Nothing
  Set m_Request = Nothing
  Set m_Response = Nothing
  Set m_Session = Nothing
  DataEnvironment1.objConn.Close
End Sub
Public Sub msOpenOrderRecapReport()
..... do lots of stuff .....
End Sub
0
pjmorris5
Asked:
pjmorris5
  • 3
1 Solution
 
Jai STech ArchCommented:
better is to use LATE BINDING rather than early binding...
if even there is any small classid change the compatibility is broken...
0
 
pjmorris5Author Commented:
I have tried late binding ...same issue.

Dim OpenRpt As Object
On Error GoTo ErrorHandler

'Establish database connection
DataEnvironment1.objConn.Open
     
 'Call the report
 Set OpenRpt = CreateObject("clsOpenReport")
   
  If Not IsObject(OpenRpt) Then
     MsgBox "Online dll not loaded properly"
     Exit Sub
  Else
     OpenRpt.msOpenOrderRecapReport
     MsgBox "Online dll referenced; module called"
  End If
   
  'Create PDF ....logic here
  'Insert into Inbox ....logic here
 
  'Close database connection
  DataEnvironment1.objConn.Close
  Close
Exit Sub
   
ErrorHandler:
     MsgBox "Error " & Err.Number & "- " & Err.Description & " Line: " & Erl
    Close
End Sub
0
 
pjmorris5Author Commented:
Is there a setting which would restrict the access to a component to only be called from within the DLL it exists in or an ASP?  The DLL I am trying to reference is run with ASPs.  All calls to components are either internal or through ASPs.  
0
 
pjmorris5Author Commented:
Resolved this issue myself ... my error was not in the call of the component, but in the component itself.  There is an object (specifically a session variable) within the component which is not defined when I am executing the component externally.  
0
 
Vee_ModCommented:
Closed, 125 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now