Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 & MTS - Context Object Errors

Status
Not open for further replies.

Netneko

Programmer
Aug 12, 1999
1
ZA
Whenever I use any methods connected to the Context Object, VB issues me a "Object variable or with block variable not defined" error. I have set references to MTS inside of VeeBee, but to no avail - what might be the cause of this ?<br>
<br>
Many thanks<br>
NetNeko<br>
<br>
<br>

 
Often the problem is using:<br>
oMyObject = something<br>
instead of:<br>
Set oMyObject = something<br>
<br>
Alex
 
Another problem is using the new keyword when setting an object variable.<br>
<br>
To use MTS you have to instantiate objects using the CreateObject function<br>
<br>
Eg. Instead of <br>
Set obj = new object<br>
set obj = CreateObject(object)<br>
<br>
<br>

 
You really should be using the CreateInstance keyword when creating MTS objects, for objects NOT controlled by MTS such as ADO recordsets etc you can use &quot;CreateObject&quot; or even better the &quot;New&quot; keyword.Using &quot;CreateObject&quot; when creating MTS objects can cause problems - especially scalability ones.Oddly enough in the new implementation of COM+ (COM+ promises to unite COM with MTS!)to run in Windows 2000 - &quot;Createobject&quot; again becomes the preffered method - funny old world isn't it? :-o)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top