Transaction method

  • Thread starter Thread starter TonyT
  • Start date Start date
T

TonyT

Hi,

Having searched KB's and Access help files, I am
struggling to find the correct syntax to get Rollback and
commitTrans to work in DAO. Here's an example of a need
for using it, if someone could be kind enough to word it
correctly for me.

Private Sub Com1_Click()
Dim strSQL1, strSQL2, strSQL3 as String
On Error goto CancelTrans
BeginTrans
strSQL1="UPDATE Tbl1....."
DoCmd.RunSQL strSQL1
strSQL2="UPDATE Tbl2....."
DoCmd.RunSQL strSQL2
strSQL3="UPDATE Tbl3...."
DoCmd.RunSQL strSQL3
CommitTrans
Exit Sub
CancelTrans:
Rollback
msgbox("FUBAR") etc.

however I try and change stuff I can not get the RollBack
part to work effectivly.
TonyT.
 
Back
Top