Solved

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

Posted on 2010-09-08
11
323 Views
Last Modified: 2013-11-27
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
0
Comment
Question by:czaz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
  • +2
11 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 250 total points
ID: 33627284
UPDATE [SomeTable]
SET [job rate] = Round([job rate] * 1.0206, 4)

or, unrounded:

UPDATE [SomeTable]
SET [job rate] = [job rate] * 1.0206
0
 
LVL 77

Expert Comment

by:peter57r
ID: 33627303
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)
0
 
LVL 1

Expert Comment

by:momo4kids
ID: 33627724
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);
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:momo4kids
ID: 33627733
Sorry...Peter57r just gave that some answer....
0
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 33628101
Use CCur, it rounds to four decimals:

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

/gustav
0
 

Author Comment

by:czaz
ID: 33628613
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
0
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 33628777
If the table is attached (linked) from another database file, the source table gets updated.

/gustav
0
 

Author Comment

by:czaz
ID: 33628869
Is there a way to see what it is linked to?
0
 

Author Comment

by:czaz
ID: 33630448
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
0
 
LVL 50

Assisted Solution

by:Gustav Brock
Gustav Brock earned 250 total points
ID: 33630639
How about:

UPDATE
  [YourTable]
SET
  [JobRate] = CCur([JobRate] * 1.0206)
WHERE
  JobCode = 'R'

/gustav
0
 

Author Closing Comment

by:czaz
ID: 33746884
Rounded as I wanted it to.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question