ADODB Object
 
Syntax
 
connectionobject.CommitTrans
 
Description
Saves any changes and ends the current transaction. It can also be set to automatically start a new transaction.
The CommitTrans method saves all pending changes made since the last BeginTrans method call was used to initiate a 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 save a new transaction. Beginning or cancelling a transaction requires the use of the BeginTrans and RollbackTrans 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.
See Also
Example
 
If MsgBox("Save all changes?", vbYesNo) = vbYes Then
   objConnection.CommitTrans
Else
   objConnection.RollbackTrans
End If