Generates a Visual FoxPro error.
Syntax
ERROR nErrorNumber
| nErrorNumber, cMessageText1
| [cMessageText2]
Arguments
nErrorNumber
Specifies the number of the error to generate. The standard Visual FoxPro error message is used when an error number is specified.
For a list of Visual FoxPro error messages and their error numbers, see "Error Messages" in the Technical Reference section.
cMessageText1
Specifies the text displayed in an error message that supplies additional information about the error. For example, if you reference a memory variable that doesn't exist, Visual FoxPro supplies the name of the memory variable in the error message.
cMessageText2
Specifies the text displayed in the error message. When cMessageText2 is specified instead of nErrorNumber, Visual FoxPro error number 1098 (user-defined error) is generated. Use a carriage return (CHR(13)) in cMessageText2 to move a portion of the error message to the next line.
Remarks
ERROR can be used to test error handling routines or to display custom error messages.
If an ON ERROR error handling routine is in effect when ERROR is issued, Visual FoxPro executes the ON ERROR routine. If an error occurs for an object, the object's Error event is executed.
If you issue ERROR from the Command window and an ON ERROR error handling routine is not in effect, Visual FoxPro displays the error message. If ERROR is issued in a program and an ON ERROR error handling routine is not in effect, Visual FoxPro displays the error message and allows you to cancel or suspend the program or ignore the error.