Microsoft Office Tutorials and References
In Depth Information
Renaming the Default Primary Key Field
choice for the primary key. Finally, the CustomerID fi eld is needed in the Contract table
as a foreign key to connect the information about contracts to customers. The data about
customers and their invoices will be stored in separate tables, which you will create in
Tutorial 2.
Notice the name of each fi eld in Figure 1-5. You need to name each fi eld, table, and
other object in an Access database.
Decision Making: Naming Database Fields and Objects in Access
One of the most important tasks in creating a table is deciding what names to specify for
the table’s fields. Keep the following guidelines in mind when you assign field names:
• A field name can consist of up to 64 characters, including letters, numbers, spaces, and
special characters, except for a period (.), exclamation mark (!), accent grave (`), and
square brackets ([ ]).
• A field name cannot begin with a space.
• Capitalize the first letter of each word in a field name that combines multiple words, for
example SigningDate.
• Use concise field names that are easy to remember and reference, and that won’t take
up a lot of space in the table datasheet.
• Use standard abbreviations, such as Num for Number, Amt for Amount, and Qty for
• Give fields descriptive names so that you can easily identify them when you view or edit
• Although Access supports the use of spaces in field names (and in other object names),
experienced database developers avoid using spaces because they can cause errors
when the objects are involved in programming tasks.
By spending time obtaining and analyzing information about the fields in the table, and
understanding the rules for naming Access fields and objects, you can determine the most
appropriate object names and create a well-designed database that will be easy for others
to use.
Renaming the Default Primary Key Field
As noted earlier, Access provides the ID fi eld as the default primary key for a new table
you create in Datasheet view. Recall that a primary key is a fi eld, or a collection of fi elds,
whose values uniquely identify each record in a table. However, according to Oren’s
plan, the ContractNum fi eld should be the primary key for the Contract table. You’ll
begin by renaming the default ID fi eld to create the ContractNum fi eld.
To rename the ID field to the ContractNum field:
1. Right-click the ID column heading to open the shortcut menu, and then click
Rename Field . The column heading ID is selected, so that whatever text you type
next will replace it.
2. Type ContractNum and then click the row below the heading. The column
heading changes to ContractNum and the insertion point moves to the row below the
heading. See Figure 1-6.
Search JabSto ::

Custom Search