Can't change Primary Key; no relationships in diagram

M

mehl

Hello --

My problem occurs in a backend mdb.

Appending to a table has started to reject rows, giving the reason as
"...key violation...".

For testing I want to remove the PK.(on a single column).

In table Design View I get the message
"You can't change the primary key.
This table is the primary table in one or more relationships."

I removed all the relationships in Tools > Relationships, so that the
window is empty.
I then compacted and decompiled the mdb.
I still can not remove the PK.

Can anyone suggest what is the problem and how I can fix it?

Thanks for any help.

Larry Mehl
 
S

Sylvain Lafontaine

If you split the database into a backend and a frontend, remove all the
relationship in the frontend will change nothing. You must remove them on
the backend.

However, removing the relationship because you have a key violation is
usually a bad idea: this means that you have probably a bug somewhere in
your vba code or that you have changed the schema of the backend without
refreshing the links on the frontend; so your best course of action is first
to refresh all the links and see what happens and if the problem is still
there after that, you will have to find this nasty bug.
 
J

John Vinson

I removed all the relationships in Tools > Relationships, so that the
window is empty.

That doesn't remove the relationships; it just clears their IMAGES
from the window.

Open the Relationships window again, and use the Show All button to
show all the relationships - or, if there are so many that this is too
confusing, select this table from the table list and select Show
Direct. Then select the JOIN LINE (not the table icon) and delete it.

I suspect that this Will Not Help, however; you may do better to
import all of the tables into a new database, *DESIGN MODE ONLY*, and
run Append queries to migrate the data from your old database, table
by table. Start with the lookup tables, then the "one" side tables,
then the "many".

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top