Results 1 to 5 of 5
  1. #1
    jeffh is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2017
    Posts
    3

    linking to one table OR another

    Hello,

    I'm trying to figure out the best way to set up tables to handle a one-or-the-other relationship. I have a table of Inventory items. I have a table of Purchase Orders and a table of Leases. So each Inventory item is related to EITHER a PO or Lease, under a 1-to-many relationship from the PO or Lease to Inventory (one PO could be related to many items). Each PO or Lease has a contract associated with it that I'd like to be able to link to Inventory items via query.

    So, I'm trying to find best way to set up relationship of these 3 tables in best way which hopefully forces/guides a one-or-the-other relationship between the individual item and either a PO or Lease, but hopefully prevent linking to both, which would be a fault (meaning an item cannot be both on PO and Lease). I thought an intermediate table might be best, but I don't have it square in my head..

    Any suggestions?

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    From your description, your inventory table should have both POFK and LeaseFK fields. You would then set business rules in your form so that only one can be populated. e.g. you might disable the POFK field in the afterupdate event of the LeaseFK field and visa versa.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Are PO and Lease fields really so different need separate tables? Or one table with a field for PO/Lease indicator?

    What are you selling/leasing?
    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
    jeffh is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2017
    Posts
    3
    Thanks. I suspected I might need to implement some business rules as a possible path. This works.

  5. #5
    jeffh is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2017
    Posts
    3
    Thanks June7. I already had a the two separate tables, and it seemed to make sense to keep the PO's in a separate listing. I might integrate with a discriminator field as you suggest if current path gets too tangled.

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

Similar Threads

  1. Replies: 29
    Last Post: 05-02-2017, 04:38 PM
  2. Linking a table
    By crowegreg in forum Programming
    Replies: 11
    Last Post: 09-23-2013, 05:16 PM
  3. Linking table
    By TDSRU in forum Access
    Replies: 18
    Last Post: 03-12-2013, 07:36 PM
  4. BE / FE new table linking
    By jordanturner in forum Access
    Replies: 3
    Last Post: 10-22-2010, 10:48 AM
  5. Table linking
    By emccalment in forum Access
    Replies: 7
    Last Post: 01-28-2010, 03:51 PM

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