Reverse action button when record is deleted?

Hello.
I have made personal bank accounts sheets. I have made the running balance to be calculated via action button (adding the amount to the current balance). I even made the action button to automatically trigger on save record. Works perfectly.

The problem is when a record is deleted. Since the action button has already added the amount to the account balance, now the future entries will work with that messed up balance.

Is there a way to forbid the deletion (lock the record) until the reverse action has been done?