BDG Scenario 3

MTSEnvironment (MTS.bas)

Attribute VB_Name = "MTSEnvironment"
Option Explicit

Public Sub SetAbort()
   Dim oc As ObjectContext
   Set oc = GetObjectContext
   If Not oc Is Nothing Then
      oc.SetAbort
   End If
   Set oc = Nothing
End Sub

Public Sub SetComplete()
   Dim oc As ObjectContext
   Set oc = GetObjectContext
   If Not oc Is Nothing Then
      oc.SetComplete
   End If
   Set oc = Nothing
End Sub

Public Function CreateInstance(ProgID As String) As Object
   Dim oc As ObjectContext
   Set oc = GetObjectContext
   If Not oc Is Nothing Then
      Set CreateInstance = oc.CreateInstance(ProgID)
   Else
      Set CreateInstance = CreateObject(ProgID)
   End If
   Set oc = Nothing
End Function

Public Sub EnableCommit()
   Dim oc As ObjectContext
   Set oc = GetObjectContext
   If Not oc Is Nothing Then
      oc.EnableCommit
   End If
   Set oc = Nothing
End Sub

Public Sub DisableCommit()
   Dim oc As ObjectContext
   Set oc = GetObjectContext
   If Not oc Is Nothing Then
      oc.DisableCommit
   End If
   Set oc = Nothing
End Sub