Results 1 to 8 of 8
  1. #1
    NEHicks is offline Novice
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    7

    Primary key issues


    I would like to turn an Excel spreadsheet into an Access database. I would like to set up an employee table using the social security # as the primary key. Every time I try, it tells me I can't have a null value, or it tells me it will create duplicate entries within one or more fields, even when I tell it "yes, duplicates ok". Any suggestions?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Don't use the SSN as the PK. Use an AutoNumber as the PK and see what happens. Then examine the table for duplicates.

  3. #3
    NEHicks is offline Novice
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    7

    Primary key issues

    I tried that at first, but the additional tables that I need to set up don't match up correctly so my queries don't run. What I have is:
    Table 1 - first, last name, ss #, dob, eod, position (RN, LPN, NA, etc)( does contain duplicates of names, due to the cultural traditions - such is the reason I want to use the SS# as the primary key)
    Table 2 - first, last name, ss#, appraisal date, rating (only for LPN, NA, etc)
    Table 3 - first, last name, ss#, proficiency due date, proficiency end date, grade, step, rating (Only for RN's)
    Table 4 - first, last name, ss#, license expiration date, state, license number (only for RN, LPN)

    What ties the 4 tables together is the ss#. The names won't have the same identical key if it's an autonumber due to some tables are only RN's & LPN's and Table 1 contains All employees, RN, LPN, NA, etc.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    To get good results in your db, you will need to Normalize your data. The actual data should only exist in one table. References to the data are done with ForeignKey fields.

  5. #5
    NEHicks is offline Novice
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    7
    So, my emp. table has the name only? and then I have a table for ss#'s?

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Table 1 has AutoNumber (PK), first, last name, ss #, etc...
    Table 2 has AutoNumber (PK), Table1(PK) as ForeignKey, appraisal date, etc...
    Table 3 has AutoNumber (PK), Table1(PK) as ForeignKey, proficiency due date, etc...
    Table 4 has AutoNumber (PK), Table1(PK) as ForeignKey, license expiration date, etc...

  7. #7
    NEHicks is offline Novice
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    7
    Thanks, I will give it a try.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Great and have fun.

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

Similar Threads

  1. Message box issues.
    By thart21 in forum Programming
    Replies: 2
    Last Post: 05-29-2010, 12:58 AM
  2. between query issues
    By jderrig in forum Queries
    Replies: 4
    Last Post: 01-15-2010, 02:30 PM
  3. Primary Key Help
    By phoenix13 in forum Access
    Replies: 4
    Last Post: 07-30-2009, 12:36 PM
  4. about the primary key!
    By Yuesko in forum Access
    Replies: 1
    Last Post: 05-29-2009, 04:20 PM
  5. Replies: 0
    Last Post: 03-11-2009, 11:40 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