Recipe database

C

Cory

My goal is to have a recipe database in which I can check
off ingredients on hand using a form, and then view a
report that would show me which recipes in my database I
have the ingredients to make.

I have tried all the recipe database templates in access
but none of them do this.

How would I do this?
 
T

tina

one basic solution uses three tables:

tblRecipes
RecipeID (primary key)
RecipeName
TotalIngredients (a number data type, Byte should be big enough)

tblIngredients
IngredientID (primary key)
IngredientName
OnHand (Yes/No field)

tblRecipeIngredients
RecipeIngredientID (primary key)
RecipeID (foreign key from tblRecipes)
IngredientID (foreign key from tblIngredients)

after building the tables, setting relationships on the matching
primary/foreign key fields, and entering data (leave the OnHand field blank
in each record in tblIngredients), you can build a form based on
tblIngredients. the purpose is to allow you to put checkmarks next to your
ingredients currently on hand. if you want to be able to clear the
checkmarks after each use, create a command button that runs an Update
query, as

UPDATE tblIngredients SET tblIngredients.OnHand = False;

create another query (i called it qryIngredientCount), as

SELECT tblRecipeIngredients.RecipeID,
Count(tblRecipeIngredients.RecipeIngredientID) AS CountOfRecipeIngredientID
FROM tblRecipeIngredients LEFT JOIN tblIngredients ON
tblRecipeIngredients.IngredientID = tblIngredients.IngredientID
WHERE (((tblIngredients.OnHand)=True))
GROUP BY tblRecipeIngredients.RecipeID;

create a third query (i called it qryAvailableRecipes), which is based
partly on qryIngredientCount, as

SELECT tblRecipes.RecipeID, tblRecipes.RecipeName
FROM tblRecipes INNER JOIN qryIngredientCount ON (tblRecipes.RecipeID =
qryIngredientCount.RecipeID) AND (tblRecipes.TotalIngredients =
qryIngredientCount.CountOfRecipeIngredientID);

it's not too pretty, but it does what you ask: it returns a list of the
recipes that contain only ingredients that you've indicated as "on hand".
should be enough to get you started.

hth
 
J

John Nurick

What do you want to happen if a recipe calls for an ingredient that you
don't actually have to hand, but for which you have an acceptable
substitute (e.g. corn starch vs potato starch, basmati rice vs long
grain rice)?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top