Results 1 to 6 of 6
  1. #1
    lefty2cox is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    May 2013
    Posts
    163

    2 one to many relationships in the same table

    Is it ok to have one table on the "one" side of a relation ship pointing to two fields in the "many" side of the relationship? See attached photo. I have a client table relating to an orders table. The orders table has both "client" and "lender" fields. I'd rather use one "clients" table to relate to both fields in the orders table rather than having a "clients" table and a "lender" table since both would have the same records. My apologies if this is confusing. I've attached a photo to illustrate. Access appears to have renamed one to "client_1".



    Click image for larger version. 

Name:	Capture.JPG 
Views:	14 
Size:	52.0 KB 
ID:	12478

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The photo is correct. You have to have "Client" and "Client_1".

    Other recommendations:
    Don't use spaces in object names
    Don't use special characters in object names ("House#", "City/Town", "Co-Borrower"). Use only letters, numbers and the underscore.

    Take the time to name fields. Having all of the tables with a primary key of "ID" will get you and Access confused. Better names would be "OrderID", "Order_Detail_ID", "ClientID"......

    Also see http://access.mvps.org/access/tencommandments.htm
    Last edited by ssanfu; 05-23-2013 at 03:26 PM. Reason: added link

  3. #3
    lefty2cox is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    May 2013
    Posts
    163
    Got it. I'm making the changes now. Thanks for you help.

  4. #4
    RonL is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Location
    NJ
    Posts
    114
    Guess you've marked this solved, but I'm still wondering if your original instinct wasn't good - that it's not optimal to repeat the same data in two different tables. (Maybe this is why Steve references the tencommandments).

    Not sure if you're developing this project or have inherited it, but how about this for an alternative: have only one "People" table, but define a new one, say "Roles". You'd make a one to many relation between Orders and Roles, and a many to many between Roles and People (which would require a junction table).

    I *think* that would provide an equivalent structure without redundancy. As a novice, I'd be interested in the pros thoughts.

    -Ron

  5. #5
    lefty2cox is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    May 2013
    Posts
    163
    Ron,

    I may be a bit confused but the client table is only one table. I had added to the relationship window twice in order to create the relationship between it and two different fields in orders. The relationship window, for reasons I don't understand as a newbie, added this table with "_1" at the end of the name. The more I looked at it, I realized that I really don't need the relationship between client table and lender field in orders because I'm really only interested in the client field in orders for billing purposes. 9 out of 10 times, both fields will be the same. The lender field will be referenced once in a while but I will never need to query on it. Am I understanding you correctly?

  6. #6
    RonL is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Location
    NJ
    Posts
    114
    Quote Originally Posted by lefty2cox View Post
    ............... I had added to the relationship window twice in order to create the relationship between it and two different fields in orders. ..........
    I didn't understand that. Sorry, my confusion. Glad it's worked out. -Ron

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

Similar Threads

  1. Table relationships
    By Prayder in forum Access
    Replies: 3
    Last Post: 04-09-2013, 08:05 AM
  2. Table Relationships
    By edthened in forum Access
    Replies: 12
    Last Post: 06-24-2012, 05:52 PM
  3. Table Relationships
    By jmany01 in forum Access
    Replies: 1
    Last Post: 05-29-2012, 11:59 AM
  4. Plz help Table Relationships
    By heominhon127 in forum Database Design
    Replies: 6
    Last Post: 09-06-2010, 01:36 PM
  5. Table Relationships?
    By Meld51 in forum Access
    Replies: 3
    Last Post: 03-01-2010, 08:34 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