ODBC Transactions will not rollback -
09-04-2003
, 04:17 PM
I have an Access 97 db linked through ODBC to an Oracle 7.3 db. The
users seelect data found in a list box and perform various functions
on the data.
Here I am simply trying to update some data based on the data selected
in the list box. If the any of the updates fail I want to roll back
the whole thing. However, the updates that occurred before the
failing point are NOT rolled back.
What is wrong with the way I am using access transactions?
Thank you,
April
Set rs = db.OpenRecordset("qryLevel1Relations")
If Not (rs.EOF And rs.BOF) Then
wrk.BeginTrans
rs.MoveFirst
Do While Not rs.EOF
If ModifyTriggers(rs!ChildTable, "disable") Then
'strSql = vbNullString
strSql = strSql & "Update " & rs!ChildTable &
" Set i_s = #" & newdate & "# where i_s = #" & olddate & "# "
strSql = strSql & "and op_desig = '" &
opdesig & "' and sect_num = " & sectnum
On Error Resume Next
db.Execute strSql, dbFailOnError
If Err <> 0 Then
wrk.Rollback
SetStatusMessage sUpdateFail,
Forms!frmMain
GoTo Cleanup
Else
strSql = vbNullString
strSql = strSql & "Update " &
rs!ChildTable & " Set o_s = #" & newdate & "# where o_s = #" & olddate
& "#"
strSql = strSql & "and op_desig = '" &
opdesig & "' and sect_num = " & sectnum
On Error Resume Next
db.Execute strSql, dbFailOnError
If Err <> 0 Then
wrk.Rollback
SetStatusMessage sUpdateFail,
Forms!frmMain
GoTo Cleanup
End If
End If
Else
SetStatusMessage sTriggerDisable,
Forms!frmMain
GoTo Cleanup
End If
rs.MoveNext
Loop
wrk.CommitTrans
DateChange = True
End If |