Topic: Junction tables?
I tried to set up a junction table test and the data grid does not appear to be handling it well.
First, I created a table called Students.
Then, I created a table called Classes.
Next, I created a junction table wtih a relationship to Students and a relationship to Classes. There are no other fields in the junction table.
I created one student record and three class records.
On my student form, I have an AddClass button that brings up a form to add the student to a class (that is, to create a record in the junction table)
This form has a dropdownbox tied to the foreignkey corresponding to classes. (JunctionTable.id_Classes) When I click the dropdown box, I get a nice list of classes.
I have an OK button which saves the record to the junction table. The only field I am writing is the combobox value, which is the class id. Honestly, I don't know where it can get the student ID, but it is being written succesfully. When I create a grid for the junction table, it shows records with the correct student id and class id.
My problem is getting a grid on the student form to list the classes that student has enrolled. If I choose JunctionTable.id_Classes, the grid lists the classes, but it lists all of them, not just the ones for the student. If I choose JunctionTable.id_Students and then try to select records from the class table, I get an error.
How do I get this to work?