Microsoft Office Tutorials and References
In Depth Information
Changing the Data Type of the Default Primary Key Field
Figure 1-6
ID fi eld renamed to ContractNum
ContractNum field
name entered in
the column heading
option for specifying
the data type for a field
AutoNumber data type
assigned to the default
primary key field (ID)
Trouble? If you make a mistake while typing the field name, use the Backspace
key to delete characters to the left of the insertion point or the Delete key to
delete characters to the right of the insertion point. Then type the correct text. To
correct a field name by replacing it entirely, press the Esc key, and then type the
correct text.
Trouble? The entire field name “ContractNum” might not be visible in the
column heading. You’ll learn how to resize columns to display the full field names
later in this tutorial.
You have renamed the default primary key fi eld, ID, to ContractNum. However, the
ContractNum fi eld still retains the characteristics of the ID fi eld, including its data type.
Your next task is to change the data type of this fi eld.
Changing the Data Type of the Default Primary Key Field
Notice the Formatting group on the Fields tab. One of the options available in this group
is the Data Type option (see Figure 1-6). Each fi eld in an Access table must be assigned
a data type. The data type determines what fi eld values you can enter for the fi eld. In
this case, the AutoNumber data type is displayed. Access assigns the AutoNumber data
type to the default ID primary key fi eld because the AutoNumber data type
automatically inserts a unique number in this fi eld for every record. Therefore, it can serve as the
primary key for any table you create.
Contract numbers at Belmont Landscapes are specifi c, four-digit numbers, so the
AutoNumber data type is not appropriate for the ContractNum fi eld, which is the
primary key fi eld in the table you are creating. A better choice is the Text data type,
which allows fi eld values containing letters, digits, and other characters, and which is
appropriate for identifying numbers, such as contract numbers, that are never used in
calculations. So, Oren asks you to change the data type for the ContractNum fi eld from
AutoNumber to Text.
To change the data type for the ContractNum field:
1. Make sure that the ContractNum column is selected. A column is selected when
you click a field value, in which case the background color of the column heading
changes (the default color is orange) and the insertion point appears in the field
value. You can also click the column heading to select a column, in which case the
background color of both the column heading and the field value changes (the
default colors are gray and blue, respectively).
2. In the Formatting group on the Fields tab, click the Data Type arrow , and then
click Text . The ContractNum field is now a Text field. See Figure 1-7.
Search JabSto ::




Custom Search