SECTION 2
Lesson 2.4: Managing Table Data Entry

   

 

 

In addition to adding protection like required values and input masks, you can also add validation rules to your database to ensure that data entered makes sense.

For example, consider the Vehicles table used in the last practice exercise. We defined that the Number of Cylinders field has a default value of 6 and the Field Size is defined as Integer which prevents decimal numbers from being entered. The field Description states that if a vehicle is equipped with a rotary engine (one that has no cylinders) that 0 should be the value. Therefore, a data entry is valid if it is a whole number greater than or equal to zero. However, no precautions are in place to prevent someone from entering a negative number of cylinders, a data entry that does not make sense.

By clicking in the Validation Rule box, you can enter a simple expression, >=0, to prevent someone from entering a negative number of cylinders:

 

 

Back in Design view, you can click the () button beside the Validation Rule field to launch the Expression Builder:

 

 

The Expression Builder lets you create customized validation rules, expressions, logical functions, and much more. We will explore the basic functionality of the expression builder later in this manual.