Rounding numbers

c17mayo

New member
Local time
Today, 03:41
Joined
Jan 8, 2008
Messages
2
I am trying to get Access to round numbers to the third decimal place and I can only get it to round up to the nearest whole number. I have used the help function and tried several things but can not get ACCESS to round as I need it. Any HELP is greatly appreciated!!
Thanks,
DOUG
 
In a query you could use

MyRoundedValue: Round([YourNumberFieldName],3)

to round the value in the column.
 
Round

Thanks I will try that. But there is more to it I think. This number comes from another number in a data base. I am VERY new with Access, but work well with Excel. Where do I put in this information?
 
Where are you having these rounding problems? Is it in a table?

I'm guessing you have stored your numbers in a numeric field with the field size long integer or integer, which doesn't store any decimals. Check/alter in the tables design view.

Depending on the precision you need, you can use for instance Single, Double, Decimal or for instance the datatype Currency.
 
My response was intended for use in a query.

Essentially, you create a new query in design view. You add the table which contains the field you want to round to the query.

Then, you can drag the field from the table onto the grid. In the column next to it, in the Field row, place the expression I gave you (substituting the field name where indicated).

Then run the query, you should see two colums. One with the original number, the other with the rounded number.

This ASSUMES that the original field containing the values you want to round is a numeric datatype (single or double) that accepts decimals (integers do not).

If the source field is text then you can work around this by converting the text string to a number before performing the round operation.
eg,
Round(CDbl([YourTextFieldNameHere]),3)

Ideally, however, you would change the datatype to suit the data you're actually storing in it.

If your source field is an integer then you will have to change its datatype to accept decimals.
 
DOUG

In Access a formula is often done by creating a field in a query. To create a field you enter the filed name followed by a colon followed by the formula.

So in this case your created field would look like

MyNewFieldName:Round([The field name that has the numbers you want rounded],3)

This is similar to putting a formula in an Excel column. The difference is that with Access it automatically applies to the whole column.

In virtually all cases a field name that is being referred to is enclosed in the square brackets.
 

Users who are viewing this thread

Back
Top Bottom