Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228

    Relationship Theory

    Who would have thought I come to the access forums for relationship advice?



    I'm just after some opinions more than anything.

    I have a table of contacts. This table lists every person within the business and related to the business (external). Each contact has an associated company so that could be our own company or another.

    This is all fine. But when I come to defining relationships to the order table I'm wondering what is best practice.

    The orders table should usually have two contacts in each record. We have the person within our company responsible for the order and then we have the person in the external company who placed the order. The user can only select the relevant people based on the company ID so again. No issue there.

    I'm wondering what is best so far as linking the tables in the relationship manager. Do I even need to?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    You should for Parent -Child tables.
    like a web shopping cart: tOrder to tOrderDetails tables.
    Or
    tClient to tClientPayments.

    but not for lookup tables, like the Country or State field.
    The State field is filled by looking up the code in tState table and filling the field in the tOrder table.
    It is not a child of tOrder, just a lookup, so I don't make a relationship.

  3. #3
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Since I've been doing this for two years now, when I started I knew almost nothing. Now that I do know something, I look back and to be honest although it works its pretty messy. So I'm redesigning it and moving the data over to a new database with the bare minimum.

    So little things like this where I'm not sure, its great you can answer them questions for me. Its surprising how much I know now compared to before.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    You would the contacts table twice. Access will alias the second copy. You relate each of the two fields in the orders table to a different instance of the contacts table.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    That's the way I have done it previously but with no relationship at all it still works as intended. It just looked messy with multiple tables with the same data.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Whether or not you create the relationship, you'd have to do that in queries to get names associated with contact ID (which I assume is what you're storing). With the relationship established you can enforce referential integrity, but of course that's up to you.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    Okay, thanks for the input. Was just making sure no one on here would shout at me for not defining the relationship before the query haha.

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

Similar Threads

  1. Theory/Advice to find "missing data"
    By Homegrownandy in forum Access
    Replies: 6
    Last Post: 02-15-2017, 09:21 AM
  2. Rolling 12 month growth Percentage **Theory Needed**
    By hockeyman9474 in forum Access
    Replies: 10
    Last Post: 02-15-2017, 08:11 AM
  3. Parts Database Theory.
    By Homegrownandy in forum Access
    Replies: 10
    Last Post: 11-14-2016, 08:27 AM
  4. Replies: 3
    Last Post: 01-03-2012, 04:12 PM
  5. Theory... Inventory Serialization
    By Cobbler in forum Access
    Replies: 5
    Last Post: 08-30-2011, 08:56 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