Creating ObjectContext with MTSEnvironment.bas

The following line from the ViewRecords method shows how to create an instance of a recordset using MTS ObjectContext:

Set oRs = CreateInstance("ADODB.Recordset")

CreateInstance is a public function in the MTSEnvironment.bas file, which creates an instance of the object ("ADODB.Recordset") under MTSEnvironment connection pooling.. The following code fragment is from CreateInstance:

Dim oc As ObjectContext
Set oc = GetObjectContext
If Not oc Is Nothing Then
   Set CreateInstance = oc.CreateInstance(ProgID)
Else
   Set CreateInstance = CreateObject(ProgID)
Set oc = Nothing