Links are not active on this page.
 ON READERROR Command

Included for backward compatibility. Use the Valid event instead.

This command is undocumented in the original VFP9 help file,
but the following documentation was found in the FoxPro for Windows 2.6 help, and may still be valid:

Specifies a command that executes in response to a data input error.

ON READERROR
	[command]

Parameters

command
 The command specified with ON READERROR executes when one of the above input errors occurs. ON READERROR typically uses DO to execute a procedure that prompts the user for correct data.

 Use ON READERROR without command to clear the previous ON READERROR.

Expand imageRemarks


Input errors that ON READERROR traps for include:

  • Invalid dates.
  • Input that falls outside of a range defined with @ ... GET ... RANGE.
  • Input that doesn't meet a condition defined with @ ... GET ... VALID.

Expand imageExample

In this example, a message is displayed if a price is entered that is lower than cost or greater than three times the cost.

CopyCode imageCopy Code
CLOSE DATABASES
SET STATUS OFF
SET TALK OFF
USE parts
ON READERROR DO errhand
@ 10,13 SAY 'Part Number: ' GET pno
@ 12,13 SAY 'Cost: ' GET cost
@ 14,13 SAY 'Selling Price: '
@ 14,28 GET price PICTURE '999.99' RANGE cost,(cost + (cost * 3)) 
READ
PROCEDURE errhand
IF price < cost
	WAIT WINDOW "Price can't be lower than cost"
ELSE
	WAIT WINDOW "Markup is too high"
ENDIF
RETURN

Expand imageSee Also