By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,515 Members | 1,339 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,515 IT Pros & Developers. It's quick & easy.

In Access SQL, is there a way to rollback a transaction?

P: n/a
In Access SQL, is there a way to rollback a transaction?

Oct 20 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I should have added that I am calling the Access data base from a VB6
program using ADO.
tom c wrote:
In Access SQL, is there a way to rollback a transaction?
Oct 20 '06 #2

P: n/a
tom c wrote:
I should have added that I am calling the Access data base from a VB6
program using ADO.
tom c wrote:
>>In Access SQL, is there a way to rollback a transaction?

The ADO Object model 2.5 and later have methods to support transactions.
BeginTrans, CommitTrans and RollbackTrans are the methods to research.

The Access help file has an example. Here are the pertinent parts:

'recordset and connection variables
Dim Cnxn As ADODB.Connection
...

' Open connection
Set Cnxn = New ADODB.Connection
Cnxn.Open strCnxn

' Open recordset dynamic to allow for changes
Set rstTitles = New ADODB.Recordset
strSQLTitles = "Titles"
rstTitles.Open strSQLTitles, Cnxn, adOpenDynamic, adLockPessimistic, adCmdTable

Cnxn.BeginTrans

' Loop through recordset

.. do your updates then

' Prompt user to commit all changes made
If MsgBox("Save all changes?", vbYesNo) = vbYes Then
Cnxn.CommitTrans
Else
Cnxn.RollbackTrans
End If
--
'---------------
'John Mishefske
'---------------
Oct 20 '06 #3

P: n/a
"tom c" <to******@gmail.comwrote in
news:11*********************@f16g2000cwb.googlegro ups.com:
I should have added that I am calling the Access data base from a
VB6 program using ADO.
Don't. Use DAO instead. DAO has provided full transactions since
Acess 2.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Oct 20 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.