Access: Round Function

In Access, the Round function returns a number rounded to a specified number of decimal places.

The syntax for the Round function is:

Round( expression [,numdecimalplaces] )

The argument number can be any valid numeric expression. The numdecimalplaces argument is is the number of decimal places to round the expression to. If this parameter is omitted, then the Round function will return an integer.

Example

Round (2.38,1)       returns 2.4 
Round (2.38,0)       returns 2
Round (2.38,1)       returns 2
Round (2.75,1)       returns 2.8
Round (2.65,1)       returns 2.6
Round (2.55,1)       returns 2.6

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.

VBA Code

Dim MyNumber As Double
MyNumber = Round(2.38,1)

This example uses the Round function to round a  integer to a specified number of decimals. Now the MyNumber variable would contain the value 2.4.

SQL query

You can also use the Round function in a query.

SELECT Round(24.65487,2) AS Expr1 
FROM Orders
admin

admin

Leave a Reply

Your email address will not be published.