Defining a Primary Key


Every table in a relational database should have a primary key. Telling Access 2007 how to define the primary key is quite simple. Open the table in Design view and click the row selector to the left of the field you want to use as the primary key. If you need to select multiple fields for your primary key, hold down the Ctrl key and click the row selector of each additional field you need.

For details about designing primary keys for your tables, see Article 1, “Designing Your Database Application,” on the companion CD.

After you select all the fields you want for the primary key, click the Primary Key button in the Tools group of the Design contextual tab on the Ribbon. Access 2007 displays a key symbol to the left of the selected field(s) to acknowledge your definition of the primary key. To eliminate all primary key designations, see “Adding Indexes” on page 188. When you’ve finished creating the Companies table for the Contact Tracking database, the primary key should be the CompanyID field, as shown in Figure 4–22.

image from book
Figure 4–22: You can easily define the primary key for the Companies table by selecting the field in Design view and clicking the Primary Key button on the Ribbon.

Be sure to click the Save button on the Quick Access Toolbar to save this latest change to your table definition.




Microsoft Office Access 2007 Inside Out
MicrosoftВ® Office Access(TM) 2007 Inside Out (Microsoft Office Access Inside Out)
ISBN: 0735623252
EAN: 2147483647
Year: 2007
Pages: 234

Similar book on Amazon
Access 2007: The Missing Manual
Access 2007: The Missing Manual
Microsoftu00ae Office Access(TM) 2007 Step by Step (Step By Step (Microsoft))
Microsoftu00ae Office Access(TM) 2007 Step by Step (Step By Step (Microsoft))
Microsoft Office Access 2007 Forms, Reports, and Queries
Microsoft Office Access 2007 Forms, Reports, and Queries
Alison Balter's Mastering Microsoft Office Access 2007 Development
Alison Balter's Mastering Microsoft Office Access 2007 Development

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net