This MSAccess tutorial explains how to use the Access **Round function** with syntax and examples.

The Microsoft Access Round function returns a number rounded to a specified number of decimal places. However, the Round function behaves a little peculiar, so before using this function, please read the following:

The Round function utilizes round-to-even logic. If the expression that you are rounding ends with a 5, the Round function will round the expression so that the last digit is an even number.

For example:

Round (12.55, 1)Result:12.6(rounds up)Round (12.65, 1)Result:12.6(rounds down)Round (12.75, 1)Result:12.8(rounds up)

In these cases, the last digit after rounding is always an even number. So, be sure to only use the Round function if this is your desired result.

The syntax for the Round function in MS Access is:

Round ( expression, [ decimal_places ] )

- expression
- A numeric expression that is to be rounded.
- decimal_places
- Optional. It is the number of decimal places to round the
*expression*to. If this parameter is omitted, then the Round function will return an integer.

The Round function can be used in the following versions of Microsoft Access:

- Access 2013, Access 2010, Access 2007, Access 2003, Access XP, Access 2000

Let's look at how to use the Round function in MS Access:

Round (210.67, 1)Result:210.7 Round (210.67, 0)Result:211 Round (210.67)Result:211

The Round function can be used in VBA code in Microsoft Access.

For example:

Dim LNumber As Double LNumber = Round (210.67, 1)

In this example, the variable called LNumber would now contain the value of 210.7.

You can also use the Round function in a query in Microsoft Access.

For example:

In this query, we have used the Round function as follows:

Expr1: Round([UnitPrice],1)

This query will return the UnitPrice rounded to 1 decimal place and display the results in a column called *Expr1*. You can replace *Expr1* with a column name that is more meaningful.

For example:

RoundedValue: Round([UnitPrice],1)

The results would now be displayed in a column called *RoundedValue*.

Question: I read your explanation of the Round function using the round-to-even logic. However, I really need to round some values in the traditional sense (where 5 always rounds up). How can I do this?

Answer: You could always use the following logic:

If you wanted to round 12.65 to 1 decimal place in the traditional sense (where 12.65 rounded to 1 decimal place is 12.7, instead of 12.6), try adding 0.000001 to your number before applying the Round function:

Round(12.45+0.000001,1)

By adding the 0.000001, the expression that you are rounding will end in 1, instead of 5...causing the Round function to round in the traditional way.

And the 0.000001 does not significantly affect the value of your expression so you shouldn't introduce any calculation errors.

(scroll to see more)

- Abs
- And
- Asc
- Atn
- Avg
- Case
- CBool
- CByte
- CCur
- CDate
- CDbl
- CDec
- ChDir
- ChDrive
- Choose
- Chr
- CInt
- CLng
- Concat with &
- Cos
- Count
- CSng
- CStr
- CurDir
- CurrentUser
- CVar
- Date
- DateAdd
- DateDiff
- DatePart
- DateSerial
- DateValue
- DAvg
- Day
- DCount
- DFirst
- Dir
- DLast
- DLookup
- DMax
- DMin
- DSum
- Environ
- Exp
- FileDateTime
- FileLen
- First
- Fix
- For...Next
- Format (with Dates)
- Format (with Numbers)
- Format (with Strings)
- GetAttr
- Hour
- If-Then-Else
- iif
- Instr
- InstrRev
- Int
- IsDate
- IsNull
- IsNumeric
- Last
- LCase
- Left
- Len
- LTrim
- Max
- Mid
- Min
- Minute
- MkDir
- Month
- MonthName
- Now
- Nz
- Or
- Randomize
- Replace
- Right
- Rnd (random number)
- Round
- RTrim
- Second
- SetAttr
- Sgn
- Space
- Split
- Sqr
- Str
- StrComp
- StrConv
- StrReverse
- Sum
- Switch
- Time
- TimeSerial
- TimeValue
- Trim
- UCase
- Val
- Weekday
- WeekdayName
- While...Wend
- Year
- --- end ---

Home | About Us | Feedback | Sitemap

While using this site, you agree to have read and accepted our Terms of Service and Privacy Policy.

Copyright © 2003-2015 TechOnTheNet.com. All rights reserved.