contents.gifindex.gifprev1.gifnext1.gif

CInt

Purpose

Explicitly converts an expression from one data type to the integer data type.

Arguments

CInt( expression )

Notes

This function explicitly controls the data type of a numeric expression. This function forces integer arithmetic in cases in which currency, single-precision, or double-precision arithmetic normally would occur. Because CInt converts expressions to integers, you can use this function to round fractional numbers. CInt differs from the Fix and Int functions, which truncate, rather than round, the fractional part of a number. When the fractional part is exactly 0.5, the CInt function always rounds it to the nearest even number. For example, 0.5 rounds to 0, and 1.5 rounds to 2.

Example

CInt converts a calculated Double to an Integer.

X = CInt( DblVal * .33 )