ACC97: Error Saving Table with Multiple Primary Key (167171)
The information in this article applies to:
This article was previously published under Q167171 Novice: Requires knowledge of the user interface on single-user computers.
SYMPTOMS
When you create a multiple-field primary key in Design view of a table, you
may receive the following error message:
Invalid index definition.
This will be followed by:
Microsoft Access was unable to create the table.
-or-
Errors were encountered during the save operation. Indexes were not
added or changed.
CAUSE
When you use the right mouse button (right-click) to create a
multiple-field primary key, Microsoft Access 97 generates two
fields in the PrimaryKey index for one of the fields in your table.
RESOLUTION
There are several ways to create a multiple-field primary key; the problem
occurs only with one of them. You can work around this behavior easily by
using one of the following methods.
Method 1: Set the Primary Key Using the Edit Menu or Toolbar- Open your table in Design view.
- Press and hold down the CTRL key, and then click the record selector
button to the left of the Field Name for each record you want to include
in your primary key. Note that the field rows are highlighted to
indicate that you have selected them.
- Release the CTRL key.
- On the Edit menu, click Primary Key.
-or-
Click the Primary Key button on the Table Design toolbar.
- Save your table.
Method 2: Edit the PrimaryKey Index- Open your table in Design view.
- Press and hold down the CTRL key, and then click the record selector
button to the left of the Field Name for each record you want to include
in your primary key. Note that the field rows are highlighted to
indicate that you have selected them.
- While still pressing the CTRL key, use the right mouse button
(right-click) to click the record selector button for one of the
fields you have selected, and then click Primary Key on the shortcut
menu that appears.
- On the View menu, click Indexes.
- In the Indexes dialog box, locate the index named PrimaryKey and
identify the field name that appears twice in that index.
- Click the record selector button to the left of the Index Name column
for the duplicate field name.
- Press DELETE.
- Close the Indexes dialog box.
- Save your table.
REFERENCES
For more information about using primary key fields in tables, search the
Help Index for "key fields, primary keys," or ask the Microsoft Access 97
Office Assistant.
Modification Type: | Major | Last Reviewed: | 10/22/2003 |
---|
Keywords: | kbprb kbusage KB167171 |
---|
|