Removing Primary Keys

C

Chakey

I am using Access tables I created from information in the company database
to delete information in the database, modify data in the access tables, and
then append the data into the company database. I need primary keys (it
appears) to delete data with primary keys in the company DB. But, to modify
data in the Access tables I need to remove the PKs to update fields that are
part of the PK.

Is there an automated way (query, macro, VB script) that I can remove the
PKs from the tables in the Access DB? They will always be the same tables.
I am using Access 2003
thanks,
 
M

Michel Walsh

If you cannot update the primary key, that is probably because there is a
relational data integrity and NO CASCADE UPDATE. Removing the primary key
(and the relations on it) will 'orphan' records from other tables. As
example, if you have tables:

Authors
AuthorID (pk)


and


BooksAuthors
BookID
AuthorID (relation with Authors.AuthorID)


then, changing Authors.AuthorID in Authors, will NOT change it in table
BooksAuthors (no cascade update) and thus, some books will become without
traceable author.



Bad idea, isn't ?


Probably better to add the CASCADE UPDATE feature to the relations, if that
ever makes sense, to update a primary key.




Vanderghast, Access 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