Search code examples
ms-accesstable-relationships

Ms-access many-to-many Relationships


I'm new to Access and trying to understand m:m relationships. I understand how to create the junction table containing a composite primary key. What I'm having trouble with is what to do next.
Tbl1 has tbl1PK, Tbl2 has tbl2PK, and JunctionTbl1_2 has J1PK and J2PK. How do I populate JunctionTbl1_2?
If I want to do a query on the records in Tbl1 and Tbl2, do I actually do the query on the junction table?
I'm just a little lost on how to use the table. Any help would be appreciated.


Solution

  • This sounds a lot like this question I answered recently, Multiple Many-to-Many Relationships (Circular Relationship) See if that answer gives you enough information for what should go in the tables. Once you have the junction (more technically the many-to-many tables) populated, a query to see which products were created by a specific employee would look something like this:

    select p_idpk from product_employee as pe where pe.e_idpk = e.e_idpk
    

    Let us know if you need more direction.