Dynamically create check box fields from data in the DB

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good day

I have a table that consists of a list of ingredients. I would like to
create a form for the user so that the user can select (check box) which
ingredients they would like.

How do i create a form to display the list of ingredients as a check box?
The list of ingredients could change. I have a column in the ingredients
database that shows if the ingredient is selected or not.

Regards,
Elena
 
Elena,

There is a many-to-many relationship between Ingredients and any particular
set of ingredients. You need an intermediate table to represent it.

Main Table: IngredientSets (One side)

IngredientSetID AutoNumber (Primary Key)
IngredientSetName Text

IngredientSetIngredients (Many Side)

ISIID AutoNumber (Primary Key)
IngredientSetID Integer (Foreign Key to IngredientSet)
IngredientID Integer (Foreign Key to Ingredients)
IngredientSelected Yes/No

You could then display on a main form based on the one side, and a
continuous subform based on the many side, linked by the IngredientSetID:

IngredientSetID: 2
IngredientSet: Bread

Ingredients:

(use a combo box to display the ingredient name rather than its ID)

Ingredient Include?
------------------------ ------------
White Flour No
Whole Wheat Flour Yes
Yeast Yes

etc.

Hope that helps.
Sprinks
 
Back
Top