Generates a Visual FoxPro error.

You can use the ERROR command to test error handling routines or to display custom error messages.

ERROR nErrorNumber | nErrorNumber, cMessageText1 | [cMessageText2]



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 Listed Alphabetically.


Specifies the text displayed in an error message that supplies additional information about the error. For example, if you reference a memory variable that does not exist, Visual FoxPro supplies the name of the memory variable in the error message.


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. To move a portion of the error message to the next line, use a carriage return (CHR(13)) in cMessageText2.

Expand imageRemarks

Expand imageExamples

Expand imageSee Also