Setting an error trap
To enable an error trap, use the ON ERROR GOTO statement where you want 
 trapping enabled within the 
   procedure.  The error-handling code must be within that procedure.  An 
 error trap is enabled only while the procedure is executing.  Use 
 the ON ERROR GOTO 0 statement where you want trapping disabled within 
 the procedure.
 
See Also
Error Overview
Error 
 Trapping
How 
 error traps work
Writing 
 an error handler
Exiting 
 an error handler
Error 
 Trapping Summary