Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / June 2007

Tip: Looking for answers? Try searching our database.

Combo Box What did I do wrong

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Esrei - 27 Jun 2007 10:50 GMT
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
Al Campagna - 27 Jun 2007 14:01 GMT
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.
Signature

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."

>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 - 27 Jun 2007 14:26 GMT
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 didn't do anything wrong.  An unbound control displays it's value on
[quoted text clipped - 13 lines]
> > 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
Al Campagna - 28 Jun 2007 13:34 GMT
Esrei,
  You wrote...
>>I do store the Ingredient ID in another field that is saved to the
>>Recipe_Ingredient_Tabel.

  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.
Signature

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
[quoted text clipped - 28 lines]
>> > the other records also change to the new selection.  What did I do
>> > wrong
Esrei - 28 Jun 2007 13:56 GMT
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,
>    You wrote...
[quoted text clipped - 41 lines]
> >> > the other records also change to the new selection.  What did I do
> >> > wrong
Al Campagna - 29 Jun 2007 23:00 GMT
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.
Signature

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:
>
[quoted text clipped - 76 lines]
>> >> > the other records also change to the new selection.  What did I do
>> >> > wrong
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.