Results 1 to 4 of 4
  1. #1
    mountainclimber is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    56

    Create relationship between multiple field primary key and anther table

    In table 1 fields Factor, Aggregations, Stat, and Days Back are fields that make up a multi-field primary key (https://www.youtube.com/watch?v=6yjpd8yb6_Q).

    I want to create a relationship between that multi-field primary key and another table, call it table 2, and make it a one-to-one relationship.

    How do I do this in MS Access 2013?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Relationships are based on your requirements. That is the data and how they relate to each other in "business". You don't arbitrarily say, " I think I'll join X to Y as 1 to Many".

    Multi-field primary keys (often called compound or composite primary keys) are fine. The issue (based on your related post) is highlighted when you have another related table and you have to repeat the all of the keys. It can get somewhat complex and unwieldy. The workaround/alternative is to use a surrogate primary key, and then make a unique composite(compound) index of the fields you originally had in the (multifield ) Primary key.

  3. #3
    mountainclimber is offline Advanced Beginner
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    56
    Quote Originally Posted by orange View Post
    Relationships are based on your requirements. That is the data and how they relate to each other in "business". You don't arbitrarily say, " I think I'll join X to Y as 1 to Many".

    Multi-field primary keys (often called compound or composite primary keys) are fine. The issue (based on your related post) is highlighted when you have another related table and you have to repeat the all of the keys. It can get somewhat complex and unwieldy. The workaround/alternative is to use a surrogate primary key, and then make a unique composite(compound) index of the fields you originally had in the (multifield ) Primary key.
    got it thanks!

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I agree. I vigorously avoid compound PK. Can use autonumber as PK and set other fields as compound index to prevent duplicate combinations.
    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: 13
    Last Post: 12-23-2013, 09:20 AM
  2. Replies: 2
    Last Post: 01-28-2013, 08:59 PM
  3. Replies: 7
    Last Post: 10-16-2012, 06:43 PM
  4. Replies: 1
    Last Post: 09-29-2010, 08:01 AM
  5. Replies: 4
    Last Post: 09-03-2009, 02:01 PM

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