Note: When you create a new table in Datasheet view, Access automatically creates a primary key for you and assigns it the AutoNumber data type.

  1. In Access, open the database that you want to modify.

  2. In the Navigation Pane, right-click the table to which you want to add the primary key, and click Design View.

    Tip: If you don't see the Navigation Pane, press F11 to display it.

  3. Locate the first available empty row in the table design grid.

  4. In the Field Name field, type a name, such as CustomerID

  5. In the Data Type field, click the drop-down arrow and click AutoNumber.

  6. Under Field Properties, in New Values, click Increment to use incrementing numeric values for the primary key, or click Random to use random numbers.

When you create a new table in Datasheet view, Access automatically creates a primary key for you and assigns it the AutoNumber data type.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.