Lesson 4.1. Understanding Field Properties
Figure 4-1. A comparison of a car's with a field's properties.
Figure 4-2. You need to be in Design view in order to view and change a table's field properties.
A property is an attribute that defines an object's appearance, behavior, or characteristics. For example, a car's properties would include its color, make and model, and shape. A property for a numeric field might be the number of decimal places displayed or the maximum number of characters a field can hold. See Figure 4-1, which illustrates the comparison.
Just about every object in Accessevery heading on a report, every label on a form, every field in a tablehas its own set of properties that you can view and change. This property concept might seem a little confusing at first, but it's something you have to learn if you want to become proficient at using Microsoft Access. Because you can almost always change object properties, you can also sometimes think of an object's properties as its settings.
Over half of this chapter is devoted to working with a table's field properties, so consider this your introduction to field properties and to properties in general.
Start Microsoft Access, if necessary, and open the Lesson 4 database.
To view and modify the Field Properties for a table, you first need to open the table in Design view.
In the Database window, select the tblCustomers table and click the Design button.
Tip: Other ways to switch to Design view are to open the table and click the View button on the toolbar, or open the table and select View
As you can see in Figure 4-2, the table design window is broken into two sections. The top section contains the table's field names and the bottom section displays the properties for the selected field. Simply click the field name whose properties you want to view.
Click the LastName field.
The lower Field Properties section of the window displays the properties for the LastName field. To change a field property, simply click the property box you want to change and enter the new settingssimple.
Table 4-1 describes all the field properties. Don't worry if some of them seem confusingyou will get a lot of practice adjusting each and every one of these properties in this chapter. It's important to note that certain types of fields have their own sets of properties. For example, number fields have a Decimal Places property while text fields do not.
Table 4-1. Important Field Properties
Text fields: The maximum number of characters (up to 255) that can be entered in the field. The default setting is 50.
Number / Currency fields: Stores the number as a Byte, Integer, Long Integer, Single, Double, or Replication ID. The default setting is Long Integer.
How the data in the field will be displayed on the screen.
Creates a format or pattern in which data must be entered.
The number of decimal places in Number and Currency fields.
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.
A value that Access enters automatically in the field for new records.
An expression that limits the values that can be entered in the field.
The error message that appears when an incorrect or restricted value is entered in a field with a validation rule.
Specify whether or not a value must be entered in the field. The default is No.
Allow Zero Length
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.
Specify whether or not you want to index the field to speed up searches and sorts performed on the field. The default is No.
TO DISPLAY A TABLE IN DESIGN VIEW:
IN THE DATABASE WINDOW, CLICK THE TABLES ICON IN THE OBJECTS BAR, SELECT THE TABLE, AND CLICK THE DESIGN BUTTON.