I've been trying to create a database that stores customer information, building/room information, and equipment (which is inside the rooms) information. I want a main form which contains customer information and two subforms, one for building/room and one for equipment.
From day 1 I knew this was a many to many relationship so I created a relationship between customers and a table called Rooms. Rooms contained building number as a field and room number as a field. However when I created the subform and made a combobox for building number, it was showing duplicate values because building name was not unique in my rooms table. So I could select a building name from the combo box, but access had no idea which primary key ID that went to and thus, what room and other information was associated with it.
To fix this issue, I put building in a separate table, like this:
I thought this would work, but then I discovered that because customer Bob owns building 1 and building 1 is assigned to room 1. If room 2 is also assigned to building 1, by default, bob also owns room 2. That is not the case. One customer could own one building/room or many. And one building/room may have many customers. So, I redesigned my database relationship to look like this:
I thought this would work, but I was having problems getting my subform to work properly. It was configured as a datasheet with building first, then room number, information about room, etc. If I selected a room it would automatically change the building name to whatever building name was associated with that room. I need to be able to select a building and then select a room.
An idea I had was to have three tables linked together in my many to many junction table. But I have never seen this done and I'm not sure how to create the subform for it, or if its even a good idea to do it this way.
I really appreciate your help. I've been working on this for almost a month now. Its so frustrating.