Results 1 to 4 of 4

Thread: GetObjectContext()

  1. #1
    gust1480
    Guest

    Question GetObjectContext()

    Dim ctxobject As ObjectContext
    Dim objAccount As Account.Pay

    Set ctxobject = GetObjectContext()
    Set objAccount = ctxobject.CreateInstance("Account.Pay")

    I'm trying to run the code above cause I want to be able to use the SetComplete and SetAbort. But it always give me the runtime error 91 : Object variable or With block variable not set.
    I noticed that the - Set ctxobject = GetObjectContext()
    doesn't seem to work cause it give my object variable Nothing. What's wrong with it?

  2. #2
    Thithimos
    Guest

    Same problem

    I'm using COM+ and previously it worked like a charm, but now it doesn't for another project I'm playing with.
    The setup as far as my server and client is the same, it just doesn't seem to be able to create the context object.
    I'm running terminal services in the client since last time I did this but I'm not sure that it matters. Most likely it wouldn't.
    Anybody here who can help? Thanks in advance.

  3. #3
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    At work, we usually do something like this :
    VB Code:
    1. Dim ctxobject As ObjectContext
    2. Dim objAccount As Account.Pay
    3.  
    4. Set ctxobject = GetObjectContext()
    5.  
    6. If Not ctxoject Is Nothing Then
    7.     Set objAccount = ctxobject.CreateInstance("Account.Pay")
    8. Else
    9.     Set objAccount = CreateObject("Account.Pay")
    10. End If

    And it works. Just don't ask me to explain it.

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  4. #4
    Thithimos
    Guest
    OK,
    So what if I'm just a plain .exe client creating an instance of a COM+ component?
    I will only have
    Dim ctxobject As ObjectContext
    Set ctxobject = GetObjectContext()
    in the component and the client will create an instance of it just like a non-COM+ component correct?
    Any ideas on why an objectcontext of Nothing is still there?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width