Access Numeric Functions

This list gives a brief description of the most useful functions to manipulate numbers in Microsoft Access VBA. Access Help gives more details and will describe exactly how these functions operate in your version of Access.

Note that functions are always followed by a pair of brackets even if - like Rnd() - there's nothing in between them. The Access editor will sometimes remove these brackets but by entering them you are telling Access that you are attempting to use a function.

Abs(<number>) Returns the absolute value of <number>.
Cos(<number>) Returns the cosine of <number> radians. See Sin and Tan
e Access does not have the value of e built in. Use Exp(1) to calculate e raised to the power of 1 or just define 2.718281828459 as a constant.
Exp(<number>) Returns e^<number>. See Log
Fix(<number>) Returns the whole number between <number> and zero. Identical to Int for positive numbers. Be careful with negative numbers.
Int(<number>) Returns the nearest whole number less than <number>. Identical to Fix for positive numbers.
Log(<number>) Returns the natural (base e) logaritm of <number>. See Exp
Pi Access VBA does not have the value of pi built in. Use 3.1415926536 or however many digits you require.
Rnd() Returns a random number. Use Randomize() to control the random number generator.
Sgn(<number>) Returns 1, 0, or -1 when <number> is positive, zero, or negative respectively.
Sin(<number>) Returns the sine of <number> radians. See Cos and Tan
Sqr(<number>) Returns the square root of <number>. Generates a runtime error if <number> is negative.
Tan(<number>) Returns the tangent of <number> radians. Generates a runtime error if <number> is Pi/4. See Cos and Tan

Other functions

Access date and time functions

Access logical functions

Access text functions