The procedure ErrorButton_Click is an entry point, that is it is called from an event not from another procedure, so you need to have a separate error handler fire from there. The error handeler you triggered with some procedure that you ran earlier end when that procedure terminates.