onAfterUpdate - is not working properly

Hi Friends,

            OnAfterupdate - I written some update the field as "Invoiced flag" is "Y". Once i clicked the save button mysql database level updated the field. again i clicked the save button is invoiced flag still "N". Default invoiced flag is "N". I clicked the back button and some same record it's updated. The problem is same page i clicked save button is not updated the flag. Please give me the solution..

           Form Type: Single

On after update means that the field update will be done after the database is updated. I think you should use onbeforeupdate. Then you can set some database variables which are then (automatically) stored.