You create record validation rules when you need to check the values in one field against the values in another. Unlike a field validation rule, a record validation rule refers to other fields in the same table. Record validation rules Use a record validation rule to control when you can save a record (a row in a table). If you enter a date earlier than 2010 and then try to place the focus on another field, Access prevents you from leaving the current field until you fix the problem. Your rule now requires users to enter dates on or after January 1, 2010. For example, suppose you have a Date field, and you enter >=# in the Validation Rule property of that field. You can create two basic types of validation rules:įield validation rules Use a field validation rule to check the value that you enter in a field when you leave the field. Data types are not optional, and provide the most basic type of data validation.įor more information about data types, field sizes, and input masks, see the article Introduction to data types and field properties. You can use these methods of validating data alone or in combination with each other. For example, an input mask can force users to enter dates in a European format, such as 2007.04.14. Input masks You can use an input mask to validate data by forcing users to enter values in a specific way. Entering text such as "Enter values between 100 and 1,000" or "Enter an ending date on or after the start date" in the Validation Text property tells users when they have made a mistake and how to fix the error. For example, entering a rule such as >100 And = forces users to enter an ending date that occurs on or after a starting date. You can also use the Validation Rule property to require specific values, and the Validation Text property to alert your users to any mistakes. For example, the Field Size property of a field restricts input by limiting the amount of data. For example, a Date/Time field accepts only dates and times, a Currency field accepts only monetary data, and so on.įield properties Some field properties restrict data input. When data is entered, Access checks to see whether the input breaks a validation rule – if so, the input is not accepted, and Access displays a message.Īccess provides a number of ways to restrict input:ĭata types Every table field has a data type that restricts what users can enter. Validation text lets you provide a message to help users who input data that is not valid. A validation rule is one way to restrict input in a table field or a control (such as a text box) on a form. This article explains how to use validation rules and validation text in table fields and form controls. Test existing data against a new validation ruleĪdd a validation rule to a control on a form Typically, you use a form validation rule instead of a field validation rule if the rule was specific only to that form and not to the table no matter where it was used. The Validation Rule control property works like a field validation rule. Validation on a form You can use the Validation Rule property of a control on a form to specify a criterion that all values input to that control must meet.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |