View Full Version : Populating Link tables


Boyohazard
06-24-2008, 05:47 AM
Hi
I have two tables, student and course, that has a many to many relationship. As I understand it this needs to be "resolved" by a link table which I have done (StudentCourseLink) utilising the student ID and course ID attributes.

This table will now be used to track what course(s) a student has attended, but how do I populate it easily and efficiently?

I have tried looking up the student id and course id and entering them manually...incredibly laborious! :eek:

I've never gone this in depth with a database before let alone Access but surely there must be a way of creating a form that makes this easier than it seems?

I'm using Access 2007. Thank you for your time.

Pat Hartman
06-25-2008, 07:24 PM
There is no way to automatically populate the junction table unless you have another data source that can be converted. The usual method for populating the relation, one record at a time is to create a main form the shows the records from one side of the relationship. If you choose students, you would use the main form to find or create a student record. There would be a subform with probably just one column. The Course would be chosed via a combo box on that subform.

It is also possible to create a set of forms that work the other way. In that case, you would have a main form that is used to find or create a new course. The subform would have one column with a combo that lists all the students and you would choose the student you wanted to add to the course.

Boyohazard
07-01-2008, 03:12 AM
Thanks Pat. That sounds exactly like what I want. Only problem now is how do I go about it :)

I've defined the relationship with referential integrity and cascading updates. I then created a form based on students but the course subform is missing entries.

I gather that by using this form it will "fill in" the junction table?

My experience lies with web based databases, I'm a complete noob when it comes to Access :D

Pat Hartman
07-01-2008, 08:11 PM
Web applications do not have this type of functionality. I've attached a sample that hopefully will show you how it works. You can also examine Northwinds. The relationship between orderDetails and Products is many-to-many so the OrderDetails subform also works the way your subform needs to work.

Boyohazard
07-02-2008, 02:13 AM
Thanks again, Pat.
Web applications do not have this type of functionality.
Yeah this is why I am so confused :)