primary key

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to assign a primary key in an existing table, but it won't let me,
something about indexes. How can I do this without deleting all of my links.
 
I'm trying to assign a primary key in an existing table, but it won't let me,
something about indexes. How can I do this without deleting all of my links.

Care to give us a bit of help here? such as the actual error messages?

You might also mention what "links" you are thinking you'll need to
delete. What's linked to what?

John W. Vinson[MVP]
 
Idcreek,

Can you give a bit more information? Are you trying to assign an
existing field as the primary key of the table? Does that field contain
duplicate values? Or are you trying to add a new field to the existing
table? If so, you won't be able to make this field the primary key
until it has data in it for all existing records.
 
The message was "The changes you requested to the table were not successful
because they would create duplicate values in the index, primary key, or
relationship. Change the data in the field or fields that contain duplicate
data, remove the index or redefine the index to permit duplicate entries and
try again". The links i referred to, are links i have established between my
bid table and my takeoff table and mastercopy table.
 
The field I'm trying to assign a primary key to is in my bid table. I didn't
assign one to the table when I began designing my database but now want to so
that I can get a one-to-many relationship. The field i want to use is a auto
number field so there should be no duplicates, right?
 
The message was "The changes you requested to the table were not successful
because they would create duplicate values in the index, primary key, or
relationship. Change the data in the field or fields that contain duplicate
data, remove the index or redefine the index to permit duplicate entries and
try again". The links i referred to, are links i have established between my
bid table and my takeoff table and mastercopy table.

Well... it would appear that the error message is telling you
precisely what's wrong: there are duplicate values in the field you're
trying to set as the Primary Key.

Try using the Query Wizard to build a Duplicate Values query to
identify which records have the same value for the field. Manually
remove or edit these records, and you should be able to create the
index.

John W. Vinson[MVP]
 
how can there be duplicates? The field that I'm using is an auto number
field. I'll run the Query Wizard as you suggest.
 
how can there be duplicates? The field that I'm using is an auto number
field. I'll run the Query Wizard as you suggest.

Two ways:

- an Append query can write data into an Autonumber field; if there is
no unique index, it's perfectly possible to insert duplicates.

- Some early versions of A200x (or JET, I'm not sure which) had a bug
which could cause the autonumber algorithm to get lost and repeat
numbers.

John W. Vinson[MVP]
 
Back
Top