Query expression cost increase by 15 percent

D

Dwayne

I have a field named cost and I need to increase it by 15%, how do I enter
that expression in a query?
 
F

fredg

I have a field named cost and I need to increase it by 15%, how do I enter
that expression in a query?


Back up your table first.

Every Cost item in the table?
Create a new query.
From the Show table dialog box, select the table you wish to update.
Drag the Cost field onto the lower grid.
Then click on Query + Update Query.

In the Update To: row of the Cost column, write:
[Cost] * 1.15

The Query in SQL view would look something like this:
Update YourTable Set YourTable.Cost = Cost * 1.15;
 
M

Martin Fishlock

Hello:

If the cost field is of type double you may need to use a round function to
ensure that you have the correct value stored after the update - as in

UPDATE Table1 SET Table1.cost = Round([cost]*1.15,2);

or in the query builder on the update to line:

Round([cost]*1.15,2)

that is if you want a set number of decimal places.
--
Hope this helps
Martin Fishlock, www.nyfconsultants.com, Bangkok, Thailand
Please do not forget to rate this reply.


fredg said:
I have a field named cost and I need to increase it by 15%, how do I enter
that expression in a query?


Back up your table first.

Every Cost item in the table?
Create a new query.
From the Show table dialog box, select the table you wish to update.
Drag the Cost field onto the lower grid.
Then click on Query + Update Query.

In the Update To: row of the Cost column, write:
[Cost] * 1.15

The Query in SQL view would look something like this:
Update YourTable Set YourTable.Cost = Cost * 1.15;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top