> Now the problem is, when you run into this in
> the middle of, let's say processing on many
> tables, reverting would leave you with a
> partially processed order for example,..
> This may lead to incorrect inventory or
> incorrect total sales when calculating commission
> for a salesman..
Take a look at BEGIN TRANSACTION, END TRANSACTION and ROLLBACK commands. Transaction is a mechanism built-in into the database to handle this type of scenario that you describe.
This is the basic structure of a transaction with two tables. You can easily extend it to handle more tables:
begin transaction
lUpdateOk = TableUpdate( 2, .F., 'OneView' )
if lUpdateOk
lUpdateOk = TableUpdate( 2, .F., 'AnotherView' )
endif
if lUpdateOk
end transaction
else
rollback
endif
Hector Correa