This is extremely helpful. It's relevant to an issue that I'm having right now in my check tracking database where I have three separate procedure calls to: save employee, save address, save check.
Now, I notice that the .Rollback command is put in the error handler. But in my case, the data processing is taking place inside these various procedures. So if I do this:
Expand|Select|Wrap|Line Numbers
- Private Sub cmdSave_Click()
- On Error GoTo Err_cmdSave_Click
- wrkCurrent.BeginTrans
- 'Employee not yet in the database
- SavePerson
- 'New employee's address, or update the address to an existing employee
- SaveAddress Forms!frmAddOrEdit
- 'Commit check edits or new check to the table
- SaveCheck
- wrkCurrent.CommitTrans
- Exit_cmdSave_Click:
- Exit Sub
- Err_cmdSave_Click:
- MsgBox "Error in subroutine cmdSave_Click: " & Err.Description, vbOKOnly + vbExclamation, "Check Tracking"
- Resume Exit_cmdSave_Click
- End Sub
...don't I need to put the Rollback in the error handlers for each of the three respective procedures?
Let me know if I need to clarify my situation. Thanks.
Pat
** Edit **
This question pertains to an article (DAO Transaction Processing - What is it?).