Results 1 to 4 of 4
  1. #1
    MAN is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    2

    creating unique primary keys after table is completed?


    I created 3 tables with biological data and chose to use an animal ID as a primary key for each one. After completing the three tables (general animal information, skull data, and tooth data) I realized that I should have used an ACCESS generated unique primary key for the skull and tooth data since I could have multiple entries for a skull or tooth parameter from a single animal. How do I add an ACCESS generated primary key to those two tables now?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I think you misunderstand the nature and use of autonumber field. The skull and tooth data tables are the many side of relationship with AnimalInfo table? If yes, then an Access generated pk in the two child tables will not relate records to the AnimalInfo table.

    A pk (autonumber or otherwise) in the two child tables is not necessary unless those tables have dependent tables.

    You can still use the animal ID as primary/foreign key. Set ID in AnimalInfo as primary and remove the PK designation on animal ID field in other tables. Set relationships in Relationship builder. Build form with subforms to enter/edit data.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    MAN is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    2
    Thank you for the info. Only one follow up question. I was under the impression that each table needed a PK, but it sounds like you are telling me to ditch the PK on the skull and tooth tables?

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    A pK is usually only needed if it is to be saved as fk in a child table. There are some advanced query techniques that rely on a unique ID value but an autonumber field can always be added later. If you already have the autonumber fields in the skull and tooth tables you can leave them but they serve no significant purpose as yet. It would be useful if you want to index/sort records in the order they were entered into table but that sort seldom has relevance to any meaningful output.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 08-19-2012, 09:55 PM
  2. Replies: 11
    Last Post: 06-11-2012, 12:23 AM
  3. creating unique ID on existing table
    By TheShabz in forum Access
    Replies: 6
    Last Post: 01-24-2011, 03:53 PM
  4. Multiple primary keys
    By elektrisk in forum Access
    Replies: 5
    Last Post: 02-11-2010, 04:39 PM
  5. Primary and Secondary Keys...
    By LittleOleMeDesigns in forum Database Design
    Replies: 5
    Last Post: 07-24-2009, 11:33 AM

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
  •  
Other Forums: Microsoft Office Forums