multiple ID's on a form

  • Thread starter Thread starter Rex
  • Start date Start date
R

Rex

Hey. I've just been creating a form for my recepies. In a
table I've typed in the information. For ingredients, I put
each ingredient on a different line, thus the program
automatically gave each ingredient a different ID. Recipie
1 therefore uses 15 lines (ID 1-15).

However, when I tranform my table into a form, or report,
only one ingredient turns up. A new form is made for each
ID no.

How can I get all my ingredients on one form? ie. How can I
include more than one ID no, on a form??

I'd love your help.
 
Rex
You need to create two tables; 1 for the recipe and 1 for
the ingredients. The recipe table should have a Primary
Key (e.g. recipeId) which is then used on the ingredient
table to show which ingredients belong to which recipes.

You will then need to design two forms; one for the recipe
data and one for the ingredients. The recipe form should
include the ingredients form as a sub-form.

Hope That Helps
Gerald Stanley MCSD
 
Hey. I've just been creating a form for my recepies. In a
table I've typed in the information. For ingredients, I put
each ingredient on a different line, thus the program
automatically gave each ingredient a different ID. Recipie
1 therefore uses 15 lines (ID 1-15).

However, when I tranform my table into a form, or report,
only one ingredient turns up. A new form is made for each
ID no.

How can I get all my ingredients on one form? ie. How can I
include more than one ID no, on a form??

I'd love your help.

I'd go a step beyond Gerald's suggestion of two tables; you need THREE
tables. An Ingredient will be used in multiple recipes, after all!

A basic concept here: you should *NOT* start designing a database with
the Form. That's like building the windows of your house before you
design the foundation. Start with your Tables, properly normalized;
*then* you can start thinking about Forms!

For a recipe database, I'd suggest the following tables.

Ingredients
IngredientID Autonumber
Ingredient Text <e.g. "Brown sugar", "White flour">
<any info about that ingredient, e.g. calories/g>

Recipes
RecipeID Autonumber
RecipeName Text <e.g. "Toll House Cookies"
Method Memo <write out the processing steps>
<any other info, e.g. Servings, nutritional info, etc.>

RecipeIngredients
RecipeID Long Integer <link to Recipies>
IngredientID Long Integer <link to Ingredients>
Quantity
Unit <e.g. cups, tsp>


To enter recipes you'ld want a Form based on Recipes, with a
Continuous Subform based on RecipeIngredients. On the Subform you'ld
have a combo box based on Ingredients - this will display "Chocolate
Chips" while storing 312 or whatever the IngredientID is.
 
Back
Top