B
brianv
i am new at access and need help with what i think should be a simple insert
statement. i have a master form with a subform in it. the master form has a
number field called RecipeId and RecipeName. the RecipeId field is not
displayed but it was retrieved by the sql. the subform has a field called
Ingredient and a non-displayed field called IngredientId. it actual displays
all the Ingredient values in the tbl. when i double click the Ingredient
field i want to insert a row into a relationship table with the values of
RecipeId and the IngredientId whose Ingredient was double clicked.
in the subform when i double click an Ingredient i start event "Double
Click" which runs this sql:
INSERT INTO RecipeIngredients(IngredientId, RecipeId) values( select
IngredientId from Ingredients where
Ingredient=[Forms]![subForm]![Ingredient], [Forms]![Master]![RecipeId])
I get a syntax error. any ideas what is wrong? Note if i hard code the
values section it will insert into RecipeIngredients the values which were
hard coded. therefore my problem is somewhere in the Values section of the
sql.
statement. i have a master form with a subform in it. the master form has a
number field called RecipeId and RecipeName. the RecipeId field is not
displayed but it was retrieved by the sql. the subform has a field called
Ingredient and a non-displayed field called IngredientId. it actual displays
all the Ingredient values in the tbl. when i double click the Ingredient
field i want to insert a row into a relationship table with the values of
RecipeId and the IngredientId whose Ingredient was double clicked.
in the subform when i double click an Ingredient i start event "Double
Click" which runs this sql:
INSERT INTO RecipeIngredients(IngredientId, RecipeId) values( select
IngredientId from Ingredients where
Ingredient=[Forms]![subForm]![Ingredient], [Forms]![Master]![RecipeId])
I get a syntax error. any ideas what is wrong? Note if i hard code the
values section it will insert into RecipeIngredients the values which were
hard coded. therefore my problem is somewhere in the Values section of the
sql.