Results 1 to 6 of 6
  1. #1
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    797

    Composite Key Table, how to populate it?

    Hi everyone,
    I have two tables (tbl_Company and tbl_Address) which I am joining with (tbl_CompanyAddress) by composite keys. I for the life of me cannot determine how this tbl_ComapnyAddress is to be populated? This tbl has two keys, one from ID in tblCompany and one from tbl_Address. Yet I don't know how to get this table to populate with the ID's from the two tables joined. Do I create in form when saved or ? I see plenty of examples of how to make these composite key tables, yet nothing on how to populate them to get quary results. I am assuming on a form when saved? Please if someone could explain to me.


    Thanks
    Dave

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    You don't need the address table ID. You don't need a 3rd table tCompanyAddress.
    just add the address fields to the company table.
    The company.id is the important one BUT just add a field called AddrID and add the address fields to tCompany table.
    when you update the address street,city, etc. everything will be in 1 record and you maintain the original Co.ID.

  3. #3
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    797
    Thanks, but its just a bit more complicated than that. I have several tables that will need the address but different tables linked to it such as company, partner and so on so just adding a look up isn't the solution. I need to have this to store addresses in one table, and link to separate tables without a look up.

  4. #4
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    So tblAddress does not have duplicates? If tblAddress is your "Main" table, add AddressID field to the other tables and use that to link tblAddress to all the other tables.

  5. #5
    d9pierce1 is offline Expert
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2012
    Location
    Oklahoma
    Posts
    797
    Maybe I am not explaining this correctly? I wouldn't say my main t is tbl_address... I also have a tbl_AddressType which is related to tbl address. There are more than one address in most cases, such as home, work, PO, Bill to...... I don't want a link to my other tables...Just a join, that's all. I don't want 10 records for each company when I have ten addresses.... Just an address type, address, and a company or Partner, Contact, Employee and so on that will have multi addresses.

  6. #6
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,511
    Maybe give better examples of your tables and their fields, the data in them and what you want the output to be.

    From what it sounds like you want is to select a company or a Partner and have it show all their addresses?

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

Similar Threads

  1. Composite key or autonumber PK
    By Liam87 in forum Access
    Replies: 4
    Last Post: 11-06-2012, 07:39 PM
  2. Composite key references same table
    By Bangsadrengur in forum Reports
    Replies: 0
    Last Post: 08-04-2011, 05:46 AM
  3. composite key question
    By revnice in forum Access
    Replies: 2
    Last Post: 08-08-2010, 12:27 PM
  4. Replies: 1
    Last Post: 07-27-2010, 08:02 AM
  5. composite unique key
    By shital in forum Access
    Replies: 1
    Last Post: 07-09-2010, 08:07 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