Home page
 
 Home 
 ASP 
 PHP 
 SQL 
 HTML 
 JavaScript 
 Search 
 Contact 
 
Search
or browse popular tags
Access Functions
Subscription

Sign up for the free email newsletter for new tips, tutorials and more. Enter your email address below, and then click the button.

Privacy Policy

RSS Twitter

Access: Round Function

Print

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


If you'd like to see how it works, enter SQL statement and press Execute
 

 
 



Tags:

Add To: Add to dzone dzone | Digg this digg | Add to del.icio.us del.icio.us | Stumble it stumbleupon

  • Comments





Copyright © 2005-2012             www.WebCheatSheet.com All Rights Reserved.