Hello everyone,
I'm working on an MS Access form setup where I have two unbound subforms and need some help with the following functionality:
- Subform 1: Lists products from the T_Products table in a continuous form.
- Subform 2: Lists hotels from the T_Hotels table, each with a checkbox.
(the reason I have it set up like this is because I will have a search as you type textbox in the main form to search the products when the list gets big)
(also, more hotels could be added in the future)
What I want to achieve:
- When I click a product in Subform 1, Subform 2 should display all hotels with unchecked checkboxes (initially as I have not yet associated any products with hotels).
- I should then be able to check hotels to associate them with the selected product.
- When I select another product and then come back to the first one, the checkboxes in Subform 2 should reflect the saved selections (i.e., the hotels previously checked should stay checked).
The idea is that the product list shows is all products available in the market, and the suppliers who sell them, and I want to assign them to the hotels of our hotel group that are authorized to buy them. Each product can have none, one or many hotels assigned to them.
I think I am on the right track. I believe I am supposed to place some SQL code in the products form on the OnCurrent event property, and in the OnClick on the checkbox to update the junction table T_Assignments. But I am struggling to get anything to work. I would appreciate anyones help.
I am on Windows 11 + Office 365. Thank you in advance.
Here is a link to the database:
https://1drv.ms/u/s!AjzjUT0wzwHggdx4epMCNu7msF58VQ
Here are screenshots:
![]()