In Access, the Sgn function returns a variant indicating the sign of a number.
The syntax for the Sgn function is:
Sgn( number )
The argument number can be any valid numeric expression. Its sign determines the value returned by the Sgn function.
If number is greater than zero, the Sgn function will return 1.
If number is equal to zero, the Sgn function will return 0.
If number is less than zero, the Sgn function will return -1.
Example
|
VBA Code
|
This example uses the Sgn function to determine the sign of a number. Now the MyNumber variable would contain the value 1.
SQL query
You can also use the Sgn function in a query.
|