Full Version: Too late to change the PK of a table?
UtterAccess Discussion Forums > Microsoft® Access > Access Tables + Relationships
mcautreels
I have a main data table with an autonum field as the PK. I have since built a good sized DB off of this table, and now might have to change the PK to a different data field (ACK!).

Is there any easy way to do this so that I don't have to update every query, table, report, form that refers to the key in this table?

If there isn't, I will leave it alone, but if there is a trick, I would love to hear it!
ALaRiva
Why would you want to change it from an Autonumber field?

What type of field are you trying to put it as?

HTH, Thanks.
mcautreels
Here are the two fields:

id (autonum, current PK): 1
task_id: MIP-1103

Someone was working with me on a portion of the DB, and suggested it. He said that if I used Task-id instead of the autonum field, I would be sure that no task_ids were duplicated, as they are imported from an external database.

Do you think it even maters? Do you think how I have it now is a 'bad' database design?
GroverParkGeorge
PMFJI.

No Don't change the PK from the autonumber field! You did it right the first time.

You can add an index to the Task-ID field to prevent duplicates.
mcautreels
Aw, right! Thanks, GroverParkGeorge! I will add an index.

By the way, what is PMFJI?
GroverParkGeorge
"pardon me for jumping in."

George
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.