Returns a value of the same type that is passed to it specifying the absolute value of a number.
The required number argument (argument: A value that provides information to an action, an event, a method, a property, a function, or a procedure.) can be any valid numeric expression (numeric expression: Any expression that evaluates to a number. The expression can be any combination of variables, constants, functions, and operators.). If number contains Null (Null: A value you can enter in a field or use in expressions or queries to indicate missing or unknown data. In Visual Basic, the Null keyword indicates a Null value. Some fields, such as primary key fields, can't contain a Null value.), Null is returned; if it is an uninitialized variable (variable: A named storage location capable of containing data that can be modified during program execution. Each variable has a name that uniquely identifies it within its level of scope. A data type can be specified or not.), zero is returned.
The absolute value of a number is its unsigned magnitude. For example,
Note Examples that follow demonstrate the use of this function in a Visual Basic for Applications (VBA) module. For more information about working with VBA, select Developer Reference in the drop-down list next to Search and enter one or more terms in the search box.
This example uses the Abs function to compute the absolute value of a number.
MyNumber = 50.3 ' Returns 50.3.
MyNumber = -50.3 ' Returns 50.3.