MS Access Field Property
MS Access Field Property
MS Access Field Property
Format
Input Mask
Decimal Places
Caption
A label for the field that will appear on forms. If you don't enter a caption, Access will use the field name
as the caption.
Default Value
A value that Access enters automatically in the field for new records.
Validation Rule
An expression that limits the values that can be entered in the field.
Validation Text
The error message that appears when an incorrect or restricted value is entered in a field with a validation
rule.
Required
Specify whether or not a value must be entered in the field. The default is No.
Specify whether or not the field allows zero-length text strings (a string containing no characters). Zero-
length text strings are useful if you must enter data in a field, but no data exists. For example, if a Social
Security field requires data, but you don't know the social security number, you would enter a zero-length
text string in the field. To enter a zero-length text string type "" in the cell. The cell will appear empty. The
default is No.
Defining Simple Field Validation Rules
To define a simple check on the values that you allow in a field, enter an expression in the Validation
Rule property box for the field. Access 2010 won't allow you to enter a field value that violates this
rule.
In general, a field validation expression consists of an operator and a comparison value. If you do not
include an operator, Access assumes you want an "equals" (=) comparison. You can specify multiple
comparisons separated by the Boolean operators OR and AND.
It is good practice to always enclose text string values in quotation marks. If one of your values is a
text string containing blanks or special characters, you must enclose the entire string in quotation
marks. For example, to limit the valid entries for a City field to the two largest cities in the state of
New York, enter "Los Angeles" Or "San Diego". If you are comparing date values, you must enclose
the date constants in pound sign (#) characters, as in #07/1/2010#.
You can use the comparison symbols to compare the value in the field to a value or values in your
validation rule. Comparison symbols are summarized in Table-4. For example, you might want to
ensure that a numeric value is always less than 1000. To do this, enter <1000. You can use one or
more pairs of comparisons to ask Access to check that the value falls within certain ranges. For
example, if you want to verify that a number is in the range of 50 through 100, enter either >=50 And
<=100 or Between 50 And 100. Another way to test for a match in a list of values is to use the IN
comparison operator. For example, to test for states surrounding the U.S. capital, enter In ("Virginia",
"Maryland"). If all you need to do is ensure that the user enters a value, you can enter the special
comparison phrase Is Not Null.
Operator Meaning
= Equal to
When you set the Required property to Yes and the user fails to enter a value, Access 2010 displays
an unfriendly message:
We recommend that you use the Validation Rule property to require a value in the field and then use
the Validation Text property to generate your own specific message.
If you need to validate a Text, Memo, or Hyperlink field against a matching pattern (for example, a
postal code or a phone number), you can use the LIKE comparison operator. You provide a text string
as a comparison value that defines which characters are valid in which positions. Access understands a
number of wildcard characters, which you can use to define positions that can contain any single
character, zero or more characters, or any single number. These characters are shown in Table-5.
Character Meaning
You can also specify that any particular position in the Text or Memo field can contain only characters
from a list that you provide. You can specify a range of characters within a list by entering the low
value character, a hyphen, and the high value character, as in [A-Z] or [3-7]. If you want to test a
position for any characters except those in a list, start the list with an exclamation point (!). You must
enclose all lists in brackets ([ ]). You can see examples of validation rules using LIKE here.
LIKE "[!0- A string that contains any character other than a number
9BMQ]*####" or the letter B, M, or Q in the first position and ends with
exactly four digits