Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2011

    Unanswered: Primary Key Change

    Is it possible to change a primary key? I thought, when I initially selected the primary key, that I had thought out the foundation well. Now I've been asked (in a round about way) to change the primary key but before I do I want to be sure it doesn't compromise all the work I've done so far.

    Is it as simple as changing the key and relationship table? Currently the key is set to "Yes (No Duplicates)" and the field I need to change the key to is also set as such.

    Last edited by bradreynolds; 05-24-12 at 11:00. Reason: (added more information)

  2. #2
    Join Date
    Dec 2010
    It is possible, but it might muck up your data a bit if you have entered any.

    and it is rather simple to do, just tends to be a bit tedious depending on how much you have used that key to do.

    just change in table design and then in relationships and quires
    If Me.OpenAccess.Work Then
    Access.Crash = Inevitable
    End If
    Me.BangHeadAgainstWall = Headache

    I dont need you to solve my problem, just give me a push in the right direction.

  3. #3
    Join Date
    Jul 2011
    Exactly what I hoped to hear. I'll back it up, give it a shot, and see what happens. Thanks for the super quick reply.

    PS Love the code.

  4. #4
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    why would someone be suggesting that you change your primary key?

    A primary key has a single purpose.. that is to uniquely identify rows. whether you use a natural key or a surrogate (and autonumber key) depedns on whats available.

    ideally you use a natural key, one that occurs 'naturally' in the data eg an order, delivery or GRN number. in soem cases there isn't an obvious key eg a person or company id. yes theoretially a company name should be unique, but it may not be, it may also be prone to misspelling or typos. or if youneed to build a compoiste key out of many columns or the unique column is a long string/text item you probably should use an autogenerated key. another reason to choose an autokey is if ay your candidate primary key is prone to changes.. its not smart to change the primary key.
    I'd rather be riding on the Tiger 800 or the Norton

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts