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 / Database Design / April 2005

Tip: Looking for answers? Try searching our database.

Recipe database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cory - 15 Apr 2005 14:40 GMT
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?
tina - 16 Apr 2005 09:51 GMT
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

> My goal is to have a recipe database in which I can check
> off ingredients on hand using a form, and then view a
[quoted text clipped - 5 lines]
>
> How would I do this?
John Nurick - 16 Apr 2005 21:05 GMT
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)?

>My goal is to have a recipe database in which I can check
>off ingredients on hand using a form, and then view a
[quoted text clipped - 5 lines]
>
>How would I do this?

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
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.