Forums
This topic is locked
Access+calculations/price
30 Aug 2001 13:21:51 jon badda posted:
using Access - i need to multipy two columns and present the results in the third (is this done with SQL within the db?)
and
i have a "current price" and "original price" columns. the original price is inseted upon adding a product, and the "current price" is whatever the price is in the other table.
is there a way to get the current price to always show the relevant current price? - would this be a relationship issue or some code to be entered?
thanks
Replies
Replied 30 Aug 2001 15:42:14
30 Aug 2001 15:42:14 Owen Eastwick replied:
1, Within the database you can create a Query that takes two columns from a table and multiplies them together (you can perform any mathematical operation you like).
SELECT YourTableName.OriginalValue, YourTableName.MultiplyBy, [YourTableName]![OriginalValue]*[YourTableName]![MultiplyBy] AS Result
FROM YourTableName
2, Need more information about your table structures and relationships to answer this.
Regards
Owen.
www.tdsf.co.uk/tdsfdemo
Edited by - oeastwick on 08/30/2001 15:43:22
SELECT YourTableName.OriginalValue, YourTableName.MultiplyBy, [YourTableName]![OriginalValue]*[YourTableName]![MultiplyBy] AS Result
FROM YourTableName
2, Need more information about your table structures and relationships to answer this.
Regards
Owen.
www.tdsf.co.uk/tdsfdemo
Edited by - oeastwick on 08/30/2001 15:43:22
Replied 30 Aug 2001 18:11:01
30 Aug 2001 18:11:01 Viktor Farcic replied:
You don't need to multiple two columns and insert result in third field. It's better if you calculate and display value in page directly. Something like:
<%= rs("column1"/rs("column2" %>
<%= rs("column1"/rs("column2" %>
Replied 31 Aug 2001 00:58:34
31 Aug 2001 00:58:34 jon badda replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
2, Need more information about your table structures and relationships to answer this.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
ok, i have an orders table a products table, a users table and a cat and sub-cat tables.
The orders table currently has a relationship to the products table and the users table via the productID and userID respectively.
Inserting the price into the Orders table upon adding a product will simply keep the price static - which is what i want for the "original price" field.
The other price field, the "current price", I want to stay the same as the price in the Products table = thus if a price in the Products table is changed, then the current price is changed in the Orders table, but the original price remains unchanged.
does this help?
thanks.
2, Need more information about your table structures and relationships to answer this.
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
ok, i have an orders table a products table, a users table and a cat and sub-cat tables.
The orders table currently has a relationship to the products table and the users table via the productID and userID respectively.
Inserting the price into the Orders table upon adding a product will simply keep the price static - which is what i want for the "original price" field.
The other price field, the "current price", I want to stay the same as the price in the Products table = thus if a price in the Products table is changed, then the current price is changed in the Orders table, but the original price remains unchanged.
does this help?
thanks.
Replied 31 Aug 2001 01:01:40
31 Aug 2001 01:01:40 jon badda replied:
oh, and the relationships are the default Access ones, er ... inner join? one to many.
dont know the technicals..sorry - but its the first check box and havent been changed because they werent broke - so to speak (grins)
dont know the technicals..sorry - but its the first check box and havent been changed because they werent broke - so to speak (grins)