1. The All-Important Primary Key
A primary key is a field or a combination of fields
in a table that uniquely identifies each row in the table (for example,
the OrderID). The most important index in a table is called the Primary Key index;
it ensures uniqueness of the fields that make up the index and also
gives the table a default order. You must set a primary key for the
fields on the one side of a one-to-many relationship. To create a
Primary Key index, you select the fields you want to establish as the
primary key and then click the Primary Key button in the Tools group of
the Design tab on the Ribbon.
Figure 1
shows the tblOrders table with a Primary Key index based on the OrderID
field. Notice that the index name of the field designated as the
primary key of the table is called PrimaryKey. Note that the Primary and Unique properties for this index are both set to Yes (true).
2. Working with Field Properties
After
you have added fields to a table, you need to customize their
properties. Field properties let you control how Access stores data and
what data the user can enter into a field. The available properties
differ depending on which field type you select. You can find a
comprehensive list of properties under the Text data type (see Figure 2). The following sections describe the various field properties. Notice that the lower portion of the Design view window in Figure 2 is the Field Properties pane. This is where you can set properties for the fields in a table.
The Field Size Property: Limiting What the User Enters into a Field
The Field Size property is available for Text and Number fields only. It’s best to set the Field Size
property to the smallest value possible. For Number fields, a small
size means lower storage requirements and faster performance. The same
is true for Text fields. To modify the Field Size property, follow these steps:
1. | Select the desired field name from the top pane of the Design view window.
|
2. | Click the Field Size property text box in the Field Properties pane.
|
3. | Type the desired field size. In Figure 2 I’ve typed 50 as the field size of the Ship Name field. |
It’s important to note that for Number fields, you should select the smallest Field Size property value that can store the values you will be entering. Limiting the Field Size property of Number fields saves disk space.
Second, to get help with a field property, you click the property line in the Field Properties pane and press F1.