BEGIN TRANSACTION
IF Not Success
ROLLBACK
TABLEREVRT(.T.)
ENDTRANSACTION
To see how to get the code formatted, replay to this and carefully look for the < pre > and < /pre > tags.
The point of the changes I made were that they removed all calls to outside routines from inside the transaction. With the code you posted there is no way to know what is screwing up the transaction because outside routines are being called and we have no idea what those routines are doing.
This recent code snippet has some basic flaws in it also,
1) ROLLBACK ends a transaction so the END TRANSACTION is redundant and will probably error because there should not be a transaction in process.
Another thing to consider is the triggers of the tables, do they start and end transactions? If they do are those transactions ended properly? What code ran before this code and after it, did that code start and not close a transaction?
The code fragment I sent you will work flawlessly, it will never leave a transaction open, the tablereverts wil work fine. That is as long as something else in your system isn't messing things up on you.