Index, Index Object.
You can use the Primary property to specify whether the index is the primary key for the table. A primary key uniquely identifies each record in a table and prevents you from entering duplicate values in a primary key field.
The Primary property uses the following settings.
Setting |
Description |
Visual Basic |
Yes |
The selected index is the primary key. |
True (-1) |
No |
The selected index isn’t the primary key. |
False (0) |
You can set the Primary property in three ways:
Microsoft Access creates an index on the primary key of the table and uses it to find records and to create joins between tables. The primary key index requires an entry in each primary key field and allows no duplicates. The order of the fields determines the default sort order for the table.
If there is no primary key when you save a table design, Microsoft Access will display a dialog box asking whether you want a primary key to be created. If you choose Yes, an AutoNumber data type field will be added to the table (with its NewValues property set to Increment) and set as the primary key. If you choose No, no primary key will be created.
A table with no primary key can’t be used in a relationship and can be slower to sort and search.
Indexed Property, Primary Property (Microsoft Office 95 Data Access Reference), Unique Property.