Microsoft Access 2010 Bible

(Rick Simeone) #1

Chapter 2: Creating Access Tables


59


Each field data type has its own set of properties. For example, Number fields have a Decimal
Places property, and Text fields have a Text Align property. Although many data types share
a number of properties (such as Name) in common, there are enough different field properties to
make it easy to become confused or to incorrectly use the properties. The following sections dis-
cuss some of the more important and frequently used field properties.

Note
The following sections include many references to properties, and property settings in the Access Table
Designer. The formal name for a property (such as DefaultValue) never contains a space, while the proper-
ty’s expression in the Table Designer usually contains a space for readabilty (Default Value). These relative
minor differences become important when referencing properties in expressions, VBA code, and macros.
When making a formal reference to a property in code or a macro, always use the “spaceless” version of the
property’s name, not the property reference you see in the Access user interface.


Common properties
Here is a list of all the general properties (note that they may not all be displayed, depending on
which data type you chose):

l Field Size: When applied to Text fields, limits the size of the field to the specified num-
ber of characters (1–255). The default is 50.
l New Values: Applies to AutoNumber fields. Allows specification of Increment or
Random type.
l Format: Changes the way data appears after you enter it (uppercase, dates, and so on).
There are many different types of formats that may be applied to Access data. Many of
these differences are explained in the “Format” section, later in this chapter.

l (^) Input Mask: Used for data entry into a predefined format (phone numbers, zip codes, Social
Security numbers, dates, customer IDs). Applicable to both Number and Text data types.
l (^) Decimal Places: Specifies the number of decimal places for the Currency and the Single,
Double, and Decimal Number data types.
l (^) Caption: Optional label for form and report fields. Access uses the Caption property
instead of the field name in these situations.
l (^) Default Value: The value automatically provided for new data entry into the field. This
value can be any value appropriate for the field’s data type. A default is no more than an
initial value; you can change it during data entry. To specify a default value, simply enter
the desired value into the DefaultValue property setting. A default value can be an
expression, as well as a number or a text string.
Note
Because the Default Value for Number and Currency data types is set to 0 by default, these fields are set
automatically to 0 when you add a new record. In many situations, such as medical test results and many
financial applications, 0 is not an appropriate default value for numeric fields. Be sure to verify that 0 is an
appropriate default value in your Access applications.

Free download pdf