Combo Box What did I do wrong

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

Guest

I have a form for entering recipies. In the subform there is 2 unbound combo
boxes for picking the ingredient category and then the ingredient.
But if I move to the next record and pick a new category the first and all
the other records also change to the new selection. What did I do wrong
 
Esrei,
You didn't do anything wrong. An unbound control displays it's value on
every record in the recordset... until that value is manually, or
programatically changed, or the form is closed.
If you don't want to see the unbound values when you access another
record, or create a new one...then use the OnCurrent event of the form to
Null out those values.

From your description though, I'm wondering why you don't save (bind)
those combo values to fields in your recipe records. I would think you
would want to capture the IngredientCategory and Ingredient... but... that's
your call.
--
hth
Al Campagna
Access MVP 2007
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love, and you'll never work a day in your life."
 
Thank you, I am losing hope, I do store the Ingredient ID in another field
that is saved to the Recipe_Ingredient_Tabel and as I do not have to save the
catagory and Descriptions as well I chose to do unbound combo boxes just for
view.

How do I set the OnCurrent event to null, and would this be in only the
subform or the main form as well. then I can insert text boxes to display,
because a recipe is always more than one ingredient.
 
Esrei,
You wrote...
I'm wondering why you're saving the IngredientID somewhere else, and
reentering it in another location. Sounds like you have some table design
problems, but without any detail regarding your tables and form setup, I
can't say for sure.

Please describe your Main form setup, and your subform setup, how they
are related, and where, why, and what you are trying to accomplish by
reentering the IngredientID into an unbound control.
--
hth
Al Campagna
Access MVP 2007
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love, and you'll never work a day in your life."
 
This is the querie that my form is based on:

SELECT Recipe_header.Recipe_Name, Recipe_header.Recipe_Description,
Recipe_header.Recipe_Catagory, Recipe_header.Preptime,
Recipe_header.Portions, Ingredient_Catagories.Ingredient_Catagories,
Ingredients.Ingredient_Description, Rec_Ing.Ingredient_Id, Rec_Ing.QTY,
Rec_Ing.Description, Recipe_header.Method
FROM Recipe_header INNER JOIN ((Ingredient_Catagories INNER JOIN Ingredients
ON Ingredient_Catagories.Ingredient_Catagories = Ingredients.[Ingredient
Catagory]) INNER JOIN Rec_Ing ON Ingredients.Ingredient_Id =
Rec_Ing.Ingredient_Id) ON Recipe_header.Recipe_HeaderID =
Rec_Ing.Recipe_headID;

I only save the Ingredient ID in my table (Rec_Ing) the Catagorie and
Description is only for the report or form. This was supose to be a simple
data base for meal plans with recipes and shopping lists to make my own life
easier.

Hope this helps and thank you for the reply

esrei
 
Esrei,
Your main form should only be based on your Recipes table.
Your subform (continuous) should based only on the Ingredients table.
The Recipe table should be related to the Ingredients table via a unique
key field (ex.RecipeID... autonumber)

ONE Recipe related to MANY associated Ingredients.

Some sample table data...

tblRecipe (Main Form... the ONE)
RecipeID RecipeName RecipePrepMinutes... etc
142 Apple Pie 60

tblIngredients (Continuous Subform... the MANY)
RecipeID Ingredient Amount UofM
142 Sugar 1 Cup
142 Apples 6 Each
142 Salt .75 Tsp
.....etc

When you view the main form for the Apple Pie record, the subform will
only show those ingredients that are associate/related to 142... the Apple
Pie RecipeID.
--
hth
Al Campagna
Access MVP 2007
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love, and you'll never work a day in your life."

Esrei said:
This is the querie that my form is based on:

SELECT Recipe_header.Recipe_Name, Recipe_header.Recipe_Description,
Recipe_header.Recipe_Catagory, Recipe_header.Preptime,
Recipe_header.Portions, Ingredient_Catagories.Ingredient_Catagories,
Ingredients.Ingredient_Description, Rec_Ing.Ingredient_Id, Rec_Ing.QTY,
Rec_Ing.Description, Recipe_header.Method
FROM Recipe_header INNER JOIN ((Ingredient_Catagories INNER JOIN
Ingredients
ON Ingredient_Catagories.Ingredient_Catagories = Ingredients.[Ingredient
Catagory]) INNER JOIN Rec_Ing ON Ingredients.Ingredient_Id =
Rec_Ing.Ingredient_Id) ON Recipe_header.Recipe_HeaderID =
Rec_Ing.Recipe_headID;

I only save the Ingredient ID in my table (Rec_Ing) the Catagorie and
Description is only for the report or form. This was supose to be a simple
data base for meal plans with recipes and shopping lists to make my own
life
easier.

Hope this helps and thank you for the reply

esrei
Al Campagna said:
Esrei,
You wrote...

I'm wondering why you're saving the IngredientID somewhere else, and
reentering it in another location. Sounds like you have some table
design
problems, but without any detail regarding your tables and form setup, I
can't say for sure.

Please describe your Main form setup, and your subform setup, how they
are related, and where, why, and what you are trying to accomplish by
reentering the IngredientID into an unbound control.
--
hth
Al Campagna
Access MVP 2007
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love, and you'll never work a day in your life."
 
Back
Top