I have a problem with objContext.setComplete

Posted on 2001-06-20
Last Modified: 2007-12-19
Dear Friends,

     I have a problem when i complete my transaction and execute objContext.setComplete. It gives an error message object variable with block variable not set. I am using COM+ in my business services and data services. I have written the sample code which i follow in my procedures.

Public Function ValidateUser(passingArgs)as RetArgs
On Error Goto ErrHandler
   Dim objContext as COMSVCSLib.ObjectContext
   Set objContext = GetObjectContext()
   'Few Code Here
   objContext.SetComplete '->> This Generates an Error

   'After Successful completion of code when
   'i use SetComplete it shows an Error Message that
   'object variable with block variable not set.

   Exit Function

End Function

Waiting for your Answer.

Thanks in Advance

Mihir Gandhi
Question by:Mihir1977
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 6209962
you should be able to call GetObjectContext.SetComplete
direct without a variable (in fact this is a more suitable solution)

Have you implemented the Object Control interface?

you'll need to add the lines:

Implements ObjectControl

Private Sub ObjectControl_Activate()

End Sub

Private Function ObjectControl_CanBePooled() As Boolean
    ObjectControl_CanBePooled = True
End Function

Private Sub ObjectControl_Deactivate()

End Sub


BTW has the object got its transaction mode property set to anything other than 0 - NotAnMTSObject?

Accepted Solution

rkot2000 earned 120 total points
ID: 6210318
I got the same error in the vbide.

Microsoft claims that SP2 for windows 2000 should fix that error.
I can?t upgrade to windows 2000, so I am using the following:  

If IsIDE = False Then
End If

Private Function IsIDE() As Boolean
  On Error Resume Next
  Debug.Assert 1 / 0
  If Err.Number = 0 Then
    IsIDE = False
    IsIDE = True
  End If
End Function

for nt4.0 you need to create a key : [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Transaction Server\Debug\RunWithoutContext]

Expert Comment

ID: 6210353
Q261871 - all info on debuging com+/mts
Q244807 PRB: Object Required Error for ObjectContext Under Windows 2000 in Visual Basic IDE and Active Server Pages

you don't need to inplement Object Control interface or use Set objContext = GetObjectContext().

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.


Expert Comment

ID: 6210531
q244807 doesn't exist anymore on

then they had the gaul to ask me to fill in a survey of how useful I found the 'Article' (read '404')

So I did! :)
LVL 49

Expert Comment

ID: 7139580
Hi Mihir1977,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept rkot2000's comment(s) as an answer.

Mihir1977, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer

Expert Comment

ID: 7140643
for debuging under windows 2000 you need to set
MTSTransactionMode to (NoTransactions or RequiresTransaction or UsesTransaction or RequiresNewTransaction)
by default you have : NotAnMTSObject :))


Expert Comment

ID: 7173282
Comment from expert accepted as answer

E-E Moderator

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Microsoft Access combo box help 2 57
Excel Automation VBA 19 116
adding "ungroup sheets" to existing vbs code 5 75
2 Global Vars, 1 List Box 4 34
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question