Hello all:
I'm having a problem that has stumped me for days, and I need help. Here is my code:
private function....
Dim objcontext As ObjectContext
Set objcontext = GetObjectContext()
On Error GoTo dataerrorhandler
Dim cmdstring
Dim oCn As ADODB.Connection
Dim oCM As ADODB.Command
cmdstring = "UPDATE TEST_WOrderTest SET
TEST_WOrderTest.OrderStatusUID = 2 WHERE
(TEST_WOrderTest.OrderUID <= " & orderuid & "
and (TEST_WOrderTest.OrderStatusUID = 1)"
Set oCn = CreateObject("ADODB.Connection"
Set oCM = CreateObject("ADODB.command"
oCn.ConnectionString= connectionstring....
oCn.CursorLocation = adUseClient
oCn.Open
With oCM
.ActiveConnection = oCn
.CommandType = adCmdText
.CommandText = cmdstring
.Execute
End With
oCn.Close
Set oCM = Nothing
Set oCn = Nothing
'everthing works, it updates the database and gets
'to this point just fine.
objcontext.SetComplete
'but this is where I get the error. #91: Object variable or
'with block variable not set. This is because
'getobjectcontext is returning nothing.
Exit Function
dataerrorhandler:
'abort the transaction
objcontext.SetAbort
End Function
I have the com+ services library referenced in my project, my component is intalled in component services and 'requires a new transaction' (I've also tried 'requires a transaction'), and I'm not calling this method from within the initialize or terminate events(which I know returns the same error.)
If anyone knows what this could be, it would be greatly appreciated.
Thank you very much
Victoria
I'm having a problem that has stumped me for days, and I need help. Here is my code:
private function....
Dim objcontext As ObjectContext
Set objcontext = GetObjectContext()
On Error GoTo dataerrorhandler
Dim cmdstring
Dim oCn As ADODB.Connection
Dim oCM As ADODB.Command
cmdstring = "UPDATE TEST_WOrderTest SET
TEST_WOrderTest.OrderStatusUID = 2 WHERE
(TEST_WOrderTest.OrderUID <= " & orderuid & "
and (TEST_WOrderTest.OrderStatusUID = 1)"
Set oCn = CreateObject("ADODB.Connection"
Set oCM = CreateObject("ADODB.command"
oCn.ConnectionString= connectionstring....
oCn.CursorLocation = adUseClient
oCn.Open
With oCM
.ActiveConnection = oCn
.CommandType = adCmdText
.CommandText = cmdstring
.Execute
End With
oCn.Close
Set oCM = Nothing
Set oCn = Nothing
'everthing works, it updates the database and gets
'to this point just fine.
objcontext.SetComplete
'but this is where I get the error. #91: Object variable or
'with block variable not set. This is because
'getobjectcontext is returning nothing.
Exit Function
dataerrorhandler:
'abort the transaction
objcontext.SetAbort
End Function
I have the com+ services library referenced in my project, my component is intalled in component services and 'requires a new transaction' (I've also tried 'requires a transaction'), and I'm not calling this method from within the initialize or terminate events(which I know returns the same error.)
If anyone knows what this could be, it would be greatly appreciated.
Thank you very much
Victoria