User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion > Hardware and Tech Support

Reply
Thread Tools Display Modes
Unread 7 Feb 2003, 10:11   #1
Supernova9
m u p p e t
 
Join Date: May 2001
Location: Whenever Wherever
Posts: 477
Supernova9 is infamous around these parts
MS Access Help Required

Wasn't sure whether to post this here or in the P&Disc. Forum, but here goes.

I'm using Microsoft Access to make an orders database. I have an Order table, which stores details of each order (OrderID, CustomerID, Date of Order, Total Price, Staff Member creating).

Then I have an OrderLine Table, which contains the details of each line of the order (OrderLineID, OrderID - which links it to the original order, and Title (The primary Key of my Product Table)).

Finally I have a product table, which contains details for each product - Title/author/Publisher/Format/Price/Supplier ID.

Now what I want to do is somehow work out the total price of the order automatically. For each order, It would have to look at each Orderline entry linked to that order and use that product title to find the price from the product table, repeating this for each of the orderlines, and then adding them all together before adding it into the Order table as Total Price.

Any Idea how I'd do this? I'm guessing a VB module of some kind but I'm stumped as to how.
__________________
Supernova9 is offline   Reply With Quote
Unread 7 Feb 2003, 10:43   #2
Not_RIT
Registered User
 
Join Date: Jan 2003
Posts: 340
Not_RIT is an unknown quantity at this point
Re: MS Access Help Required

Quote:
Originally posted by Supernova9
Wasn't sure whether to post this here or in the P&Disc. Forum, but here goes.

I'm using Microsoft Access to make an orders database. I have an Order table, which stores details of each order (OrderID, CustomerID, Date of Order, Total Price, Staff Member creating).

Then I have an OrderLine Table, which contains the details of each line of the order (OrderLineID, OrderID - which links it to the original order, and Title (The primary Key of my Product Table)).

Finally I have a product table, which contains details for each product - Title/author/Publisher/Format/Price/Supplier ID.

Now what I want to do is somehow work out the total price of the order automatically. For each order, It would have to look at each Orderline entry linked to that order and use that product title to find the price from the product table, repeating this for each of the orderlines, and then adding them all together before adding it into the Order table as Total Price.

Any Idea how I'd do this? I'm guessing a VB module of some kind but I'm stumped as to how.
No idea how to do it with access, but I could probably do it with Excel. As a matter of fact Im currently working on an Excel/VBA stock/sales/user management program at the moment.

perhaps: tables("tablename").Cells(first numerical cell, second numerical cell).Value

If A and 1 are your First numerical cell and Second numerical cell then you would put in 1, 1

Maybe that will let your reference Access in VBA, check the msdn libary for the commands :/
Not_RIT is offline   Reply With Quote
Unread 7 Feb 2003, 11:56   #3
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
You could use a custum SQL query to display this:

SELECT SUM(product.price) FROM orders,products WHERE product.id=order.productID AND order.id = 1

Basically what you want to use is the SUM() function of SQL. I have no idea how to implement this in access, since I've last done access a year or two ago.
Structural Integrity is offline   Reply With Quote
Unread 7 Feb 2003, 16:02   #4
Raging.Retard
Street Tramp
 
Raging.Retard's Avatar
 
Join Date: Apr 2000
Location: Street Gutter
Posts: 341
Raging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant future
Access supports 'an implementation' of SQL (its quite messed up though... it likes parenthesis around everything). The easist way to do it would be to use the query generator to select all the price rows, then just change to SQL view and append SUM( ) round the coloumn in question.
__________________
Chimney Pots.
Raging.Retard is offline   Reply With Quote
Unread 7 Feb 2003, 21:23   #5
Caesar2
Commander
 
Caesar2's Avatar
 
Join Date: Sep 2001
Location: Netherlands
Posts: 146
Caesar2 is just really niceCaesar2 is just really niceCaesar2 is just really niceCaesar2 is just really nice
you use a form with a subform?
__________________
Quote:
Originally posted by Cochese
Cathaar are not overpowered.

You were just "bashed", live with it.
Caesar2 is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 01:57.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018