|
Validation rules are used to validate user-entered data. You can define a validation rule in either the Database Painter or in the DataWindow Painter. If a validation rule is defined for a column in the Database Painter, the rule displays in the Column window in the DataWindow Painter and you can change it for the current DataWindow.
Note: Changing the validation rule for a DataWindow does not change the rule in the database.
To specify a validation rule:
- Double-click the column name and number. The Column window displays. If a validation rule was defined for the column in the Database Painter, it displays and you can override it here for the DataWindow.
- Click the Validate button to define a new validation rule. The Column Validation Definition window displays.
- Define the validation rule. To identify a column, use the name of the column or the number of the column's position in the DataWindow.
For example, to check that the data entered by the user is a positive number, use this validation rule: Integer(GetText(dw_Emp)) > 0.
- Enter a string or expression in the Error Message Expression box to change the message that displays when a value in the column does not pass validation and an ItemError event occurs. The expression in the Error Message Expression box will display instead of the standard error message.
- Click the Verify button to verify the expressions but not close the Column Validation Definition window.
- Click the OK button to verify the expressions and close the Column Validation Definition window.
- Click the OK button to close the Column window and display the DataWindow Painter workspace.
|