| ON_ERROR | |
| Trap an error. |
| Formats | ||
| On_error | statement | |
| On_error | ||
| [statement ...] | ||
| [statement ...] | ||
| End_error |
| This command is similar to BASIC's ON ERROR goto ... construct, except that the statements to execute when an error occurs are located directly after the ON_ERROR statement. The statement must be executed for the error trap to be enabled. The trap remains enabled after an error occurs. Multiple error traps are allowed in forms and subroutines. Errors will continue to be trapped by the program until a No_error command is issued. |
| Example | ||
| On_error Goto CALCFAIL | ||
| C = ((B + 1) / A) /B | ||
| On_error | ||
| Error "Record not found" | ||
| Return %ERROR | ||
| End_error | ||
| Get c in DB /Record | ||
| Return | ||
| CALCFAIL: | ||
| Error "Record calculation failed" | ||
| Return %ERROR | ||