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?

Post's attachments

Attachment icon JunctionTableExperiment.vdb 19 b, 595 downloads since 2014-09-06 

Re: Junction tables?

Please, send me all files from project folder to email support@drive-software.com


Thanks.

Dmitry.

Re: Junction tables?

I actually got this to work by using forms and grids in a specific way.  It actually works quite well as long as you follow a certain procedure.  I'll get back to you with details later.  (It's been a very long day and I'm just too tired to explain, but I wanted to let you know I found a solution.)