Results 1 to 4 of 4
  1. #1
    Helystra is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2013
    Posts
    35

    Question about Primary Keys

    I have a question about single and multi field primary keys.



    For example in my employees table I have the autonumber ID field, first name and last name. That relates to a Certifications table where I track the employee's certifications.

    On the form for certifications, I would like to see the employee's name when I'm entering the data for their certifications. Will I be able to do that if I only set the autonumber as the primary key or do I need to include the first and last name fields in the primary key as well for that to happen?

  2. #2
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Use only the autonumber field as the key - the rest is not needed. When you need to display the name, you'll build it using either a join, a dlookup, or a combobox bound to the autonumber but set to display the name, depending on the circumstances of usage.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,600
    Names are tricky. Need to allow duplication because people can have same name. It might be rare for your data but not impossible. For this reason they make poor keys.

    Including names with ID as compound key won't prevent creating a new record for same person in Employees table and doesn't help to find correct person for Certification record. Use additional info to verify identity.

    I do everything I can to avoid compound keys.

    Agree with Dal, save the autonumber as foreign key and retrieve name info as described.
    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.

  4. #4
    Helystra is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2013
    Posts
    35
    Great thanks.

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

Similar Threads

  1. Multiple Primary Keys
    By JonathanOz in forum Access
    Replies: 2
    Last Post: 03-22-2013, 08:32 AM
  2. Changing primary keys
    By ksammie01 in forum Database Design
    Replies: 4
    Last Post: 02-07-2013, 07:56 PM
  3. Primary Keys & Relationships
    By Njliven in forum Programming
    Replies: 4
    Last Post: 12-17-2012, 09:42 AM
  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

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