Create table in access with two primary key

Anonymous
2015-02-24T00:24:25+00:00

I create a table in access with two primary key but when I try to view the Datasheet, appear the following error shown in the image. I need an option to create this table.

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2015-02-24T00:50:33+00:00

    Just to clarify: A Table cannot have "two primary keys" ([Highlander]There can only be one![/Highlander].) It can however have a single primary key which consists of two - or three, or even ten - fields, which jointly must be unique.

    Your error message explains what is wrong: there already exist at least two records in the table with identical values of Plan and Description. Try creating a Totals query grouping by Plan and Description and counting records to find which records have duplicates.

    Could you explain the logic of this table? It's ordinarily not necessary to have a "description" as part of a primary key. A PK should meet three desiderata: it MUST be unique (see Highlander above :-{) ); it should be stable, not something that will be changed often or at all; and ideally it should be short, such as a Long Integer or Autonumber which can be an efficient link to foreign key fields in other tables. How will this table be used, and what is the point of this two-field key?

    0 comments No comments
  2. Anonymous
    2015-02-24T01:55:37+00:00

    Hi John,

    I need this table to create relations with other table to stored in columns in tables as all data. I create a form with combobox that form so that it uses combo boxes and have correlated the Plan combobox with the Description combobox so that only Description for the selected Plan are listed.

    0 comments No comments