Access: Abs Function

In Access, the Abs funtion returns the absolute value of a number.

The syntax for the Abs function is:

Abs( number )

The argument number can be any valid numeric expression. If number contains Null, Null is returned. The absolute value of a number is its unsigned magnitude. For example, ABS(-1) and ABS(1) both return 1.

Example

Abs (-1.45)   returns 1,45 
Abs (2.17)    returns 2,17

VBA Code

Dim MyNumber 
MyNumber = Abs(42.7)
MyNumber = Abs(-42.7)

This example uses the Abs function to compute the absolute value of a number. Now the MyNumber variable would contain the value 42.7.

SQL query

You can also use the Abs function in a query.

SELECT Abs([Salary]) AS Expr1 
FROM EmployeeStatisticsTable
admin

admin

Leave a Reply

Your email address will not be published.