Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I’ve obviously taken the wrong approach to this and need some help. 10 years of what I thought was a sensible approach has been turned on its head.
Using trans As Transaction = Application.DocumentManager.MdiActiveDocument.TransactionManager.StartTransaction : trcnt += 1 : LastOpenedTransaction = Reflection.MethodBase.GetCurrentMethod.Name()
MySub(trans)
trans.Commit() : trcnt -= 1 : If trcnt > 0 Then : MsgBox("TRCNT>0" & vbCr & "Last opened transaction in " & LastOpenedTransaction) : LastOpenedTransaction = "" : End If
End Using
This monitored if all the transactions opened had been closed as well as reporting on which last transaction failed.
Feels like a bug but, I recently discovered that this method doesn’t allow me to undo all the operations committed under one undo command.
If I now need to add transactions to each subroutine, how do I now monitor failures?
If a coding error occurred the try..catch often didn’t catch anything so my tactic was to create a master transaction, pass that transaction to each subroutine, and monitor that.
Solved! Go to Solution.