Returns a value that indicates whether an object supports transactions. Read-only Boolean.
Syntax
expression .Transactions
expression A variable that represents a Recordset object.
Remarks
In a Microsoft Access workspace, you can also use the
Transactions property with dynaset- or table-type
Recordset objects. Snapshot- and forward–only–type
Recordset objects always return
False.
If a dynaset- or table-type Recordset is based on a Microsoft Access database engine table, the Transactions property is True and you can use transactions. Other database engines may not support transactions. For example, you can't use transactions in a dynaset-type Recordset object based on a Paradox table.
Check the
Transactions property before using the
BeginTrans method on the
Recordset object's
Workspace object to make sure that transactions are supported. Using the
BeginTrans,
CommitTrans, or
Rollback methods on an unsupported object has no effect.
Example
This example demonstrates the Transactions property in Microsoft Access workspaces.
Sub TransactionsX()
Dim wrkAcc As Workspace
Dim dbsNorthwind As Database
Dim conPubs As Connection
Dim rstTemp As Recordset
Set wrkAcc = CreateWorkspace("", "admin", "", dbUseJet)
Set dbsNorthwind = wrkAcc.OpenDatabase("Northwind.mdb")
' Open two different Recordset objects and display the
' Transactions property of each.
Debug.Print "Opening Microsoft Access table-type " & _
"recordset..."
Set rstTemp = dbsNorthwind.OpenRecordset( _
"Employees", dbOpenTable)
Debug.Print " Transactions = " & rstTemp.Transactions
Debug.Print "Opening forward-only-type " & _
"recordset where the source is an SQL statement..."
Set rstTemp = dbsNorthwind.OpenRecordset( _
"SELECT * FROM Employees", dbOpenForwardOnly)
Debug.Print " Transactions = " & rstTemp.Transactions
rstTemp.Close
dbsNorthwind.Close
conPubs.Close
wrkAcc.Close
End Sub