pjmorris5
asked on
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.msOpenOrderRecapR eport' 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.O pen
'Call the report
Set OpenRpt = New clsOpenReport
If Not IsObject(OpenRpt) Then
MsgBox "Online dll not loaded properly"
Exit Sub
Else
OpenRpt.msOpenOrderRecapRe port
MsgBox "Online dll referenced; module called"
End If
'Create PDF ....logic here
'Insert into Inbox ....logic here
'Close database connection
DataEnvironment1.objConn.C lose
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(objScriptingCo ntext As ScriptingContext)
'Set reference to the Web's ScriptingContext objects
On Error Resume Next
Set m_Application = objScriptingContext.Applic ation
Set m_Request = objScriptingContext.Reques t
Set m_Response = objScriptingContext.Respon se
Set m_Session = objScriptingContext.Sessio n
DataEnvironment1.objConn.O pen
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.C lose
End Sub
Public Sub msOpenOrderRecapReport()
..... do lots of stuff .....
End Sub
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.msOpenOrderRecapR
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.O
'Call the report
Set OpenRpt = New clsOpenReport
If Not IsObject(OpenRpt) Then
MsgBox "Online dll not loaded properly"
Exit Sub
Else
OpenRpt.msOpenOrderRecapRe
MsgBox "Online dll referenced; module called"
End If
'Create PDF ....logic here
'Insert into Inbox ....logic here
'Close database connection
DataEnvironment1.objConn.C
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(objScriptingCo
'Set reference to the Web's ScriptingContext objects
On Error Resume Next
Set m_Application = objScriptingContext.Applic
Set m_Request = objScriptingContext.Reques
Set m_Response = objScriptingContext.Respon
Set m_Session = objScriptingContext.Sessio
DataEnvironment1.objConn.O
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.C
End Sub
Public Sub msOpenOrderRecapReport()
..... do lots of stuff .....
End Sub
ASKER
I have tried late binding ...same issue.
Dim OpenRpt As Object
On Error GoTo ErrorHandler
'Establish database connection
DataEnvironment1.objConn.O pen
'Call the report
Set OpenRpt = CreateObject("clsOpenRepor t")
If Not IsObject(OpenRpt) Then
MsgBox "Online dll not loaded properly"
Exit Sub
Else
OpenRpt.msOpenOrderRecapRe port
MsgBox "Online dll referenced; module called"
End If
'Create PDF ....logic here
'Insert into Inbox ....logic here
'Close database connection
DataEnvironment1.objConn.C lose
Close
Exit Sub
ErrorHandler:
MsgBox "Error " & Err.Number & "- " & Err.Description & " Line: " & Erl
Close
End Sub
Dim OpenRpt As Object
On Error GoTo ErrorHandler
'Establish database connection
DataEnvironment1.objConn.O
'Call the report
Set OpenRpt = CreateObject("clsOpenRepor
If Not IsObject(OpenRpt) Then
MsgBox "Online dll not loaded properly"
Exit Sub
Else
OpenRpt.msOpenOrderRecapRe
MsgBox "Online dll referenced; module called"
End If
'Create PDF ....logic here
'Insert into Inbox ....logic here
'Close database connection
DataEnvironment1.objConn.C
Close
Exit Sub
ErrorHandler:
MsgBox "Error " & Err.Number & "- " & Err.Description & " Line: " & Erl
Close
End Sub
ASKER
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Closed, 125 points refunded.
Vee_Mod
Community Support Moderator
Vee_Mod
Community Support Moderator
if even there is any small classid change the compatibility is broken...