ADO » Connection » RollbackTrans


Cancels any changes that have occurred during the current transaction and then ends the transaction. It can also be set to automatically start a new transaction.

The RollbackTrans method cancels all pending changes made since the last BeginTrans method call was used to initiate the transaction.
For example, a transaction could be a monetary transfer between two accounts. First, you would withdraw money from one account and next you would deposit the money into a second account. Both actions must be correctly accomplished for such a transaction to be considered completed.
Since transactions can be nested, all lower-level transactions must be resolved before you can resolve higher-level transactions. (i.e., level 3 transactions must be either committed or cancelled before level 2, etc.)
This method is only used to cancel a new transaction. Beginning or saving a transaction requires the use of the BeginTrans and CommitTrans methods.
Not all providers allow transactions. You can search the Properties Collection to see if the Transaction DDL property occurs as part of the collection.
The provider will automatically start a new transaction after a RollbackTrans call, if the Attributes property of the Connection object is set to adXactCommitAbort.


If MsgBox("Save all changes?", vbYesNo) = vbYes Then
End If

See Also: