Solved

Rounding A Calculated Field in an Access Query

Posted on 2011-09-21
6
395 Views
Last Modified: 2012-08-13
Hi experts!  

Here is the code I'm using for my calculated field:

Percentage: ([quantity]*[makeup])/100

The result currently shows two decimal points.  I would like this field to round to the nearest whole number, no decimals.  Please help!

Thank you.
0
Comment
Question by:Sashaski
[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
  • 3
  • 2
6 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 250 total points
ID: 36575988
Try this

Percentage: Round(([quantity]*[makeup])/100 , 0)

mx
0
 
LVL 75
ID: 36576004
OR this:



Percentage: FormatNumber(([quantity]*[makeup])/100 , 0)

mx
0
 
LVL 48

Expert Comment

by:Dale Fye (Access MVP)
ID: 36576009
Well, you could do it in the formatting of the field, just set the # of decimals to 0

Or you could use the Round() function:

Percentage: Round([quantity]*[makeup]/100)
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Closing Comment

by:Sashaski
ID: 36576069
Brilliant!  Amazing the time blown on the small things...I appreciate you!
0
 
LVL 75
ID: 36576104
You are welcome.

I actually like FormatNumber() better, because IF ... you need two dec pts, you can't get that with Round() - in some cases:

?Round(55/22,2)
 2.5

?FormatNumber(55/22,2)
2.50

mx
0
 

Author Comment

by:Sashaski
ID: 36576129
Great tip to add to my plethora of tips, in fact I should create a database for database tips!
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

691 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