This is essentially a question of getting the logical model right and then representing the model in a form/subforms. You start with tables for the three principle entity types:
Bars
....BarNumber (PK)
....BarName
Events
....EventID (PK)
....EventName
....EventDate
Products
....ProductID (PK)
To model the many-to-many relationship type between bars and products, i.e. the products stocked by default in each bar, you need a table:
BarProducts
....BarID (FK)
....ProductID (FK)
the primary key of this table is a composite one made up of both columns.
To model the many-to-many relationship type between bars and events you need a table:
EventBars
....EventID (FK)
....BarID (FK)
The primary key of this table is again a composite one made up of both columns.
You then need a table to model the relationship type between EventBars and BarProducts:
EventProducts
....EventID (FK)
....BarID (FK)
....ProductID (FK)
....BeginningWeight
The primary key of this table is again a composite one, this time made up of the three columns EventID, BarID and ProductID. EventID and BarID make up a composite foreign key referencing the composite primary key of EventBars, and BarID and ProductID make
up a composite foreign key referencing the composite primary key of BarProducts.
In an events form, in single form view, you'll firstly need a subform, in continuous forms view, based on EventBars, linked to the parent form on EventID and a further subform in continuous forms view, based on EventProducts. In the first you enter one row
per bar used for the event. The EventProducts subform needs to be correlated with the EventBars subform so that as you navigate from row to row in the latter, the EventProducts subform will be requeried to show the rows for the currently selected bar. This
is done by including a hidden text box in the parent form, txtBarIDHidden say, whose ControlSource property references the BarID control in the EventBars subform, e.g.
=sfcEventBars.Form!BarID
where sfcEventBars is the name of the subform control, i.e. the control in the parent form which houses the subform. The LinkMasterFields property of the EventProducts subform will then be:
EventID;txtBarIDHidden
and its LinkChildFields property will be:
EventID;BarID
To automatically insert rows into the EventProducts subform you can execute an SQL statement in the AfterInsertEvent of the EventBars subform:
Dim strSQL As String
strSQL = INSERT INTO EventProducts(EventID, BarID, ProductID) " & _
"SELECT " & Me.EventID & ", BarID, ProductID " & _
"FROM BarProducts " & _
"WHERE BarID = " & Me.BarID
CurrentDb.Execute strSQL, dbFailOnError
' requery EventProducts subform to show new rows
Me.Parent.sfcEventProducts.Requery
This will show rows in the subform for all products stocked by default in the bar in question. If there are any which will not be available for the current event you can delete those rows in the EventProducts subform.
In the relationship between EventBars and EventProducts be sure to enforce cascade deletes so that if a row ids deleted in the EventBars subform the rows in EventProducts for the bar in question will automatically be deleted.