3
CHAPTER 3: Create and Modify Tables
65
HowTo-Tght (8) / How to Do Everything with Microsoft Office Access 2003 / Andersen / 222938-1 / Chapter 3
Modify or Delete the Primary Key
You might find that the primary key does not always have a unique value after all and decide to
use a different field or create a primary key with two or more fields.
To change the primary key, select the row you want as the primary key and click the Primary
Key button. The key icon is removed from the old key field and appears in the new one.
To add another field to the existing primary key, select both the old and new key fields, then
click the Primary Key button. The key icon appears in the row selector of both rows.
There might be times when you want to temporarily disable the primary key—for example,
when importing records from another table, some of which might contain values that duplicate
your original table. You must remove any duplicates in the new data before restoring the primary
key. This has no effect on the data stored in the field designated as the key; it just removes the
key field feature temporarily.
To remove the primary key designation effectively, select the primary key field and click the
Primary Key button. If the key is used in a relationship, you must delete the relationship before
you can remove the key.
Modify or Delete an Index
To delete a single-field index, change the field’s Indexed property to No. This removes only the
index; it has no effect on the field itself or the underlying data.
In the Indexes dialog box, you can add or delete fields from a multiple-field index, change
the sort order for any field in the index, or change the index properties. You can also change the
field order in the index.
¦
To remove a field from a multiple-field index, display the Indexes dialog box, select
the field row, and then press
DEL
.
¦
To remove the entire index, display the Indexes dialog box, select all the rows in the
index, and then press
DEL
.
¦
To insert an additional field into the index, display the Indexes dialog box, select the field
below where you want the new field to appear, press
INSERT,
and then enter the new
field name.
¦
To change the field order in a multiple-field index, select and drag the field selector to
the desired position in the index definition.
¦
To change the sort order for any of the fields in the index, choose from the Sort Order list.
After making changes to the table’s indexes, you must save the table.
Ensure Data Validity
You have seen how Access can ensure that the values entered in your database are valid. For
example, the data type you choose for the field can limit the values to date and time values. You
can also limit the number of characters in a Text field and prevent duplicate values. A direct way
to ensure valid data is to set some rules that the values must obey.
P:\010Comp\HowTo8\938-1\ch03.vp
Thursday, August 07, 2003 6:37:34 PM
Color profile: Generic CMYK printer profile
Composite Default screen
Previous Main Next