Avatar of czaz
czaz
Flag for United States of America asked on

Increase number in table cell by percentage & round to nearest decimal.

I have an access table that has a column of job rate.   Ex: 4.2516.      They need all the numbers (in the cells) in this column increased by  2.06% .   So the example would now be 4.3392   (they want it still to be rounded to the 4th decimal place.)

I know mathwise, it is (X * 1.0206) but am unsure how to apply this formula to all the cells in the column
Microsoft AccessSQL

Avatar of undefined
Last Comment
czaz

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Patrick Matthews

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
peter57r

Well you really need to agree rounding rules with your users, otherwise you will have arguments about the 4 th DP values.

The datatype of the JobRate field is important.
If it is currency you can do..
Update tablename set [job rate] = 1.0206*[Job Rate]

However if it is a double, then you will have to round:
Update tablename set [job rate] = round(1.0206*[Job Rate],4)
momo4kids

You can also update the cells using an update query.  It should look something like this....
UPDATE [Tablename] SET [Tablename].JobRate = Round([JobRate]*1.0206,4);
momo4kids

Sorry...Peter57r just gave that some answer....
Your help has saved me hundreds of hours of internet surfing.
fblack61
Gustav Brock

Use CCur, it rounds to four decimals:

UPDATE
  [YourTable]
SET
  [JobRate] = CCur([JobRate] * 1.0206)

/gustav
czaz

ASKER
Is is possible for updates in one database to effect other files??
I ran a script & it seems to have updated a field accross multiple files, even ones in archive?

How is this possible
Gustav Brock

If the table is attached (linked) from another database file, the source table gets updated.

/gustav
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
czaz

ASKER
Is there a way to see what it is linked to?
czaz

ASKER
I found where the file is linked to and was able to restore data.

They are altering their request.  They want updates based on a JobCode of 'R',  So the current request is if JobCode=R, update the JobRate datafield.

BTW: I am using Access 2003
SOLUTION
Gustav Brock

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
czaz

ASKER
Rounded as I wanted it to.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck