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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Table Calculation

Status
Not open for further replies.

mAd1

IS-IT--Management
Mar 13, 2001
1
US
I'm trying to multiply one column called "Price" and the other called "Tax" and the result to end up in the column called "Cal_Tax". I've tried and tried and keep getting some really werid results, can someone please HELP!!!!!
 
"Price" and the other called "Tax" and the result to end up in the column called "Cal_Tax".

In an UPDATE QUERY.

Column Name = Cal_Tax

Update To = [Price] * {Tax]
MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Hi,

MichaelRed is right, if you need to store the result (Cal_Tax) in the table. This would also mean you need to run the update query everytime you add a record.

You might be better off though if you make a normal query which returns this value, and base your forms/reports on that query. The query needs to have the table you are referencing, plus an expression:
Cal_Tax: [Price] * [Tax]
in the Field space in the QBE (query) grid. This arrangement would have the added benefit of Cal_Tax being read-only.

Cheers
 
Hi All,

Thanks for the info, I did exactly as both have mentioned and all that gets returned to the table are 0's or 1's. Can you guys figure out why this is happening?
 
mAD-1:
Check your field data types for all the fields: Perhaps you're multiplying $5.00 (currency) * 5% (single/double) and the Cal_Tax field would have to be single or double to accept fractions... You may need to add some conversion math here to see a correct result. Gord
ghubbell@total.net
 
MAd1,

Gord is correct, It almost certainly has to do with the data type of one of the variables. If you have added the field to the table, the default data type is Long (Integer). If one of the fields (Tax?) is a single (decinal) w/ a value of ~ 3 (0.03) to 5 (0.05) Percent, and the reatil field is ~ < 20. to 30. then most of the values would be 0 or 0ne. In this instance, all you need to do is change the data type to Dingle (or double, or curency).


MichaelRed
redmsp@erols.com

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top