Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 4th, 2006, 10:42 AM
Authorized User
 
Join Date: Mar 2006
Location: , , .
Posts: 83
Thanks: 1
Thanked 0 Times in 0 Posts
Default Problem creating drinks control database

Hello!

I am trying to build a cocktail drinks control database.....basically I have the following already:

One table (tblRecipeDefinition) which contains two fields - Cocktail Name and CocktailID (primary key).

Another table (tblRecipeIngredients) which contains five fields (IngredientID (primary key), Ingredient Name, Measure Unit, Quantity, and CocktailID (which is used to link to the first table - one-to-many relationship))).

Now...this is where I am having trouble....how would I be able to use these tables, so that each day, I can input the total quantity of cocktails that are sold in a restaurant or bar, and the database will calculate for me (and generate a report) that shows the total consumption of each INGREDIENT by the end of the day? I am not very good with Access or VBA so step by step would be highly appreciated! :)

Thank you very much!
Reply With Quote
  #2 (permalink)  
Old May 5th, 2006, 10:28 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You will need a table to enter sales in that is also looks up to the tblRecipeDefinition table.

Are you keeping a tally outside of the database, and then entering in a total value for each day, or are you checking off each sale one by one in the database?

The table would be something like:

tblSales
SalesID - PK
SalesDate - Default = Date()
CocktailID - FK to tblRecipeDefinition
Quantity - Number field
(Options)
BartenderID - FK to tblBartender?

tbltblRecipeDefinition
(Options)
Price - currency - price charged per cocktail

tblRecipeIngredients
(Options)
Cost - currency - food cost per ingredient qty

tblBartender
PK
LName - text
FName - text
etc
Salary - currency

These last fields and tables will allow you to do better cost accounting, and also see what each bartender is making you, and costing you.

Then you could do a query to multiply the total number of each cocktail sold by the ingredients in the tblRecipeIngredients table, how much cost there was associated with prices charged, etc, etc.

Anyway, if you create this first table, and then a query or queries, you can get this info out of this structure.

HTH

mmcdonal
Reply With Quote
  #3 (permalink)  
Old May 5th, 2006, 07:53 PM
Authorized User
 
Join Date: Mar 2006
Location: , , .
Posts: 83
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hello and thank you for your reply!

I will try your suggestions in the morning and let you know my results. Yes...basically the sales are being generated as they are entered in the POS. So at the end of the day, I print out a sales reports (i.e. total number of each drink that are sold during the day) and I intend to enter them into the Access database that I am trying to create so it gives me the ingredient consumption based on the recipe definition table.

Well..I will try in the morning and I will let you know.

Thank you! :)
Reply With Quote
  #4 (permalink)  
Old May 5th, 2006, 07:56 PM
Authorized User
 
Join Date: Mar 2006
Location: , , .
Posts: 83
Thanks: 1
Thanked 0 Times in 0 Posts
Default

What exactly do you mean by FK and PK? And what type of query would I try to create? A select? Append?

Thanks! :)
Reply With Quote
  #5 (permalink)  
Old May 8th, 2006, 06:27 AM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

PK = Primary Key - this is the PK for the table. For example, in the tblRecipeIngredients table, IngredientID is the PK.

FK = Foreign Key - this is a look up field and takes the numeric PK value from the table it is looking up to. For example, in the tblRecipeIngredients table, CocktailID is an FK.

There is only one PK per table, but there can be many FK's per table. If a field is an FK, you should index that field as well.

mmcdonal
Reply With Quote
  #6 (permalink)  
Old August 5th, 2006, 09:33 AM
Registered User
 
Join Date: Aug 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please help. I am trying to build a similar cocktail database but cannot seem to identify the correct tables to use. I am a real beginner with Access so any help would be greatly appreciated.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem: Creating the Example Database dcr BOOK: Beginning SQL 1 October 11th, 2007 07:56 AM
Creating a new control Bhattachan ASP.NET 2.0 Basics 0 August 12th, 2007 11:07 AM
problem i creating my own tool bar control in c# ch_faf General .NET 1 July 29th, 2004 07:29 AM
problem creating database nusrati MySQL 15 July 6th, 2004 10:46 AM



All times are GMT -4. The time now is 11:56 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.