Error 91 with GetObjectContext.CreateInstanc
Author Message
 Error 91 with GetObjectContext.CreateInstance

I'm creating an instance of a business tier object by using the
createInstance method of the getObjectContext object and when I try to
instantiate the object I get error 91, "object variable or with variable
block not set."

However, my code is laid out pretty much like it should be.  I have the
component set to binary compatability.  The component is not a member of an
MTS package (just like Info: VB6.0 Read Me Part 12. says to do).  I've got
references set in the client program to the business object.  I've Dim an
object variable as the correct object type.  But I get error 91 every time I
step through it and it gets to the createInstance call.  I've got a
reference to the MTS Transaction library and I'm able to use the
auto-complete feature of VB for both the object and the GetObjectContext, so
I know the references are correct.

Here's what my code looks like

    Dim objCustomer as bo_Customer.boGetCustomer
    .
    .
    .
    Set objCustomer =
GetObjectContext.CreateInstance("bo_Customer.boGetCustomer")

as soon as the de{*filter*} gets to the set statement it crashes.

Does anybody have any suggestions?  This is the only thing standing between
me and success with this project.  If anybody has any answers please let me
know.

thank you so much,

Clifford R. Tillman, Jr.



Sat, 06 Jul 2002 03:00:00 GMT  
 Error 91 with GetObjectContext.CreateInstance
Several things to check:

If you are using VB6, make sure that you do NOT have the VB5 MTS add-in
loaded.  VB6 works directly with MTS without the add-in.

If using VB6, you can leave the object in MTS.  You will notice when you run
it that the path under MTS will change to a debug path instead of the dll's
installed path.  Just make sure that the path for the binary compatibility
DLL is the same as the one installed in your MTS package.

If you are running the MTS component in in a group with the client app,
don't. Run it in it's own instance of VB, and the client app in another.  If
the object that is being instantiated by the ObjectContext.CreateInstance is
another MTS object, run that one in yet another instance of VB.  This is the
quirkiest thing to debug in MTS and I usually just use CreateObject for
debugging, then switch my code back to ObjectContext.CreateInstance when I'm
satisfied that it works.   Often, setting the break point AFTER the object
is instantiated will work.  It seems there are "timing" issues with getting
this when debugging.

On your development machine, if you have ever run a MTS remote install "exe"
that installs the mts package as if you were a client, make sure you
uninstall it, and make sure you re-register all MTS components in
winnt\system32\mts.  Running the exe that MTS's export utility creates for
you can install & register a copy of mtxas.dll in the \Program Files\Remote
Applications\<<GUID>> folder that can cause nightmares for you.

Brian A. Manlove
Magenic Technologies Int'l.



Quote:
> I'm creating an instance of a business tier object by using the
> createInstance method of the getObjectContext object and when I try to
> instantiate the object I get error 91, "object variable or with variable
> block not set."

> However, my code is laid out pretty much like it should be.  I have the
> component set to binary compatability.  The component is not a member of
an
> MTS package (just like Info: VB6.0 Read Me Part 12. says to do).  I've got
> references set in the client program to the business object.  I've Dim an
> object variable as the correct object type.  But I get error 91 every time
I
> step through it and it gets to the createInstance call.  I've got a
> reference to the MTS Transaction library and I'm able to use the
> auto-complete feature of VB for both the object and the GetObjectContext,
so
> I know the references are correct.

> Here's what my code looks like

>     Dim objCustomer as bo_Customer.boGetCustomer
>     .
>     .
>     .
>     Set objCustomer =
> GetObjectContext.CreateInstance("bo_Customer.boGetCustomer")

> as soon as the de{*filter*} gets to the set statement it crashes.

> Does anybody have any suggestions?  This is the only thing standing
between
> me and success with this project.  If anybody has any answers please let
me
> know.

> thank you so much,

> Clifford R. Tillman, Jr.



Sat, 06 Jul 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. GetObjectContext.CreateInstance vs. new

2. HELP : Error 91 : Run-Time Error 91 Object Variable or With

3. System.Activator.CreateInstance vs CreateInstanceFrom

4. DCOM ERROR Run-time error "91"

5. Please help with VB4.0 Object Server error and error 91

6. error 91 with block variable not set

7. db = CurrentDb returns error 91 in project

8. Error 91 - Object Variable Not Set **** Need Help

9. Help needed with SQL (runtime Error 91)

10. Runtime error 91

11. Object variable not set (error 91) ???

12. Multi Select getting Error 91

 

 
Powered by phpBB® Forum Software