Freigeben über


Recordset.Transactions-Eigenschaft (DAO)

Gilt für: Access 2013, Office 2013

Gibt einen Wert zurück, der angibt, ob ein Objekt Transaktionen unterstützt. Schreibgeschützter boolescher Wert.

Syntax

Ausdruck . Transaktionen

Ausdruck Eine Variable, die ein Recordset-Objekt darstellt.

Bemerkungen

In a Microsoft Access workspace, you can also use the Transactions property with dynaset- or table-type Recordset objects. Recordset-Objekte vom Typ Snapshot- und Forward-Only geben immer False zurück.

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.

Überprüfen Sie die Transactions-Eigenschaft, bevor Sie die BeginTrans -Methode für das Workspace -Objekt des Recordset-Objekts verwenden, um sicherzustellen, dass Transaktionen unterstützt werden. Das Anwenden der Methoden BeginTrans, CommitTrans und Rollback auf nicht unterstützte Objekte hat keine Wirkung.

Beispiel

In diesem Beispiel wird die Transactions-Eigenschaft in Microsoft Access-Arbeitsbereichen veranschaulicht.

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