Suppose I have a recipe as below.
Expand|Select|Wrap|Line Numbers
- Recipe ID: 1001
- Ingredient Percentage Allergen
- Milk 10% Milk
- Wheat Flour 50% Wheat
- Water 35%
- Sugar 4%
- Salt 1%
The ingredient name, allergen and percentage exist in an Access query named Q_Recipe_Allergen where several tables are joined. The rows of above recipe are from a SubForm that resides in a MainForm containing recipe header information, such as RecipeID.
I tried the following codes, but it didn’t work. I know something is missing but I don’t know how to fix it.
Expand|Select|Wrap|Line Numbers
- Private Sub Txt_Recipe_Allergen_AfterUpdate()
- Set db = CurrentDb()
- Set rs = db.OpenRecordset("Select '[Allergen]' From [Q_Recipe_Allergen] WHERE '[recipeID]=Me![Txt_RecipeID]'")
- Me.Txt_Recipe_Allergen = rs
- End Sub