Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to calculate data from two fields?

Status
Not open for further replies.

sammx

Technical User
Jun 30, 2002
25
US
Hi All,
I built two fields: "retail price" and "cost"
How can I make another field to calculate the difference between these two fields?
For example:
retail price cost profit
100 2100 = 100-(2100/20)
Thanks
 
You can do it in the select statement.

select (retailprice - (cost/20)) as profit
from table
 
Hi cmmrfrds,
Can you indicate more details?
What kind of "data type" should I choose?
And then, from which do I use select (retailprice - (cost/20)) ?
Thanks
 
You do not need to place a new field for [Profit] in you table. Calculate the new field on your form, or on your report. Place a new textbox on the form and place the follwing formula into the "control source" property of the t"profit textbox:

=[Retail]-([Cost]/20)

Where you see [Retail] Place the name of your retail textbox in between the brackets and the name of your [Cost] textbox between the next brackets. This will calculate the profit on the fly, and will not take up additional memory in your table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top