Subform instead of listbox Part 2

GingGangGoo

Registered User.
Local time
Today, 08:22
Joined
Dec 14, 2010
Messages
121
I've been a very basic Access user for a long time, and now I'm working on a project and using it to teach myself or learn better db building. I know almost no VBA code and I'm not ready to go to that level yet. I keep seeing in different searches for information that it's better to use a subform as selection list then a list box, and I'd like to do that but I'm unsure how.

Here is what I have so far: Three tables, students, classes and studentclasses all related correctly. So far so good. Next I have a form based on the student table for entering in basic student info. What I want is a subform on this form where I can choose a students various classes to add records to studentclasses with studentId & classId. I know I can do this with a list box, but because it seems to be considered better to do it with a subform only, and because I'd like to learn how, how do I build this.

FWIW - I don't like the look and feel of the list box. I've tried to design one to look as much like the check off list type control you get when you do a combo box based on a multivalued field, but of course without the tick marks, since that isn't possible, and not putting multiple values in one field. I'd like my subform to be as much like that as possible, so that if I were an end user, I could just click to that tab, or click a button, or scroll to the bottom and see a list of choices for the record in focus on the main form with out empty space next to the column, or empty space in the detail section, etc.

Thanks for any help
 
Last edited:
It sounds like the main form is working fine.

Create a new form, and base it on "studentclasses" table. You can lay this out however you want, but to display all records at once you will either need to set the view to "Datasheet" or "Continuous Forms".

You can then drag the new subform from the database window and drop it onto your main form while it is open in design view.

Now click on the subform and open the property sheet. On the data tab you can set the field to link the two forms. Select StudentID for both Master (your main form) and Child (your subform).

Hopefully the subform will now only display classes for the selected student.

Hope this helps
 
It sounds like the main form is working fine.

Create a new form, and base it on "studentclasses" table. You can lay this out however you want, but to display all records at once you will either need to set the view to "Datasheet" or "Continuous Forms".

You can then drag the new subform from the database window and drop it onto your main form while it is open in design view.

Now click on the subform and open the property sheet. On the data tab you can set the field to link the two forms. Select StudentID for both Master (your main form) and Child (your subform).

Hopefully the subform will now only display classes for the selected student.

Hope this helps

Ok, I see, and that works great. However that seems to be the set up for viewing the data once I've entered in the classes for each student. What I need to do is be able to pick those classes in the first place so that the "new" combined data fill the junction table.
 

Users who are viewing this thread

Back
Top Bottom