Office 2010 - Access

Lesson 14: “Design View” (3)

14/76 Lessons 

Field Properties (2)

“Default”
If you ever need to repeat the same value in a field, it is possible to assign it a default value.

For example, most of our albums are on “cassette”. When we fill “cassette” as “Default value” in the field properties box, then this field, in this case the field “Type” will be automatically filled in with “cassette”.

If your album is on a different media, just type over this text.

les14_image001_en

Validation Rule

We use “Validation Rule” in the “Field Properties” box , to determine one or more rules that need to be fulfilled to enter the data in this field.

For example, in the “Value” field, we give the values 1, 2 or 3, depending on how we find the song.

We do not want to have a different value entered in this fields. So, we can set a rule for this.

First, we select the “Value” box, naturally.
Select the “Validation Rule” field property.
Click the button to the right of this box.
This opens the “Expression Builder” dialog box .

les14_image002_en

In the upper section of the “Expression Builder” dialog box, type as follows- ‘1 Or 2 Or 3’.

In the previous version of the “Expression Builder” dialog box, there was another toolbar, this unfortunately disappeared in version 2010. If you have never heard of it, you just search on “Google” for “Access Expressions”.

When you switch back to “Datasheet view” and you try to any value other than 1, 2 or 3, you get warning message that the valid values for this field are only 1, 2 or 3.

If you would you like to type a “Validation rule”, you can type directly into this box and place the text in quotation marks. For example, “very good” Or “good” Or “bad”.

An example of how the “Input Mask” and “Validation Rule” field properties are used together:

For example, for the field “Location”.
Type in the “Input Mask” example “Cbinet “0; 0;_
And in the “Validation Rule” we type “Cabinet 1” Or “Cabinet 2” Or “Cabinet 3”.
les14_image004_en

Save the table by clicking the “Save” button in the “Quick Access” toolbar.
Switch to the “Datasheet View”.

All you now need to enter in the “Location” is the number 1, 2, or 3. The word ‘Cabinet’, plus the space will be added automatically.

Validation Text

The “Validation Text” field property is the text that appears in the alert window when a value entered in the field does not comply with the “Validation Rule”.

les14_image003_en

Awesome!
You've completed Lesson 14
START NEXT LESSON