I'm working on a Microsoft Access application for a summer camp to track which entities have signed up for which activities. There is a form for editing an entity's information. I would like to add to that form a list of all activity options. By each option should be a checkbox. When the checkbox by an option is checked, a entry should exist in the many-to-many junction table linking the entity with the activity.
Google offered some examples of building many-to-many forms but none (at least that I found) showing how to provide a full list of options with checkboxes.
How would I do this?
Database Table Layout: Entity (EntityID, first name, last name, etc.) Activity (ActivityID, activity name) Entity_Activity (EntityID, ActivityID)
Create a multiple item formOn the Create tab, in the Forms group, click Multiple Items. If Multiple Items is not available, click More Forms, and then click Multiple Items. Access creates the form and displays it in Layout view.
Open the form in design view. Select the option group by clicking on its border. If necessary, resize it to make room for the new option button. Select the Option Button control (aka radio button) in the Controls group of the Design tab of the ribbon.
One way to do this:
I was hoping for an approach that didn't require manually laying out the form. With this method, every time a new activity is added, the form must be modified. Oh well....
Instead of check-boxes, the more natural way to do it with MS Access would be to have a list of activities (in a sub form) that each entity is signed up for. Activities would get added from a pull down list (and perhaps an Add button), and removed with a Remove button. With a clever query, you limit that list to only activities that the entity doesn't have yet.
Alternately, you could go with the checkboxes, but you'll have to modify your table layout slightly. Entity_Activity would need a third field (SignedUp, yes/no). You would then have to populate every Entity_Activity combination when you created a new Entity. However, if you should happen to add another Activity later on, you'll have to go through some hoops to get all the existing Entity's entries updated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With