Hi Simon
A relationship between two tables must have a unique key on one side.
Therefore, the only relationships that can be directly represented are those
which have a "one" side, i.e. one-to-one, and one-to-many relationships.
Many relationships in real life are many-to-many. For example, one employee
can enrol in many courses, and one course can accommodate many employees.
These many-to-many relationships must be modeled using a junction table and
two one-to-many relationships.
The junction table, therefore, contains TWO foreign key fields, which
represent both the "many" sides of the two relationships.
Often the junction table contains only those two fields, but sometimes it
may be appropriate to store additional data there. This must happen ONLY if
the data are attributes of the COMBINATION of the two foreign keys. For
example, the date enrolled, date completed, and final result are all
attributes of the combination of employee and course.
So, a junction table represents a many-to-many relationship. It is
generally used to simulate a one-to-many relationship between one of the
tables, and a *query* based on the junction table and the other table.
For example, you could create a form showing employee details with a subform
(based on a query) showing details of the courses that employee has enrolled
in.
Similarly, you could create a form showing course details with a subform
(based on a query) showing details of the employees that enrolled in that
course.
Hope this helps
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
Simon said:
Hello,
How and Where do you use Junction tables?
I'm trying to create a many-to-many relationship between Employees and
Modules. I have 4 tables related like such:
Employees EmpCourseJoin Modules MainTable
EmpID EmpID ModID MainID ( PK )
EmpName ModID DocNum EmpID ( FK to Employees )
ModID ( FK to
Modules )
Q. How and where do I use the EmpCourseJoin table.
Q. What exactly is the Join table supposed to do.
-Simon