CLng

Function that converts an expression into a Long (Number) value

Syntax
      CLng (expression)

Fractional values will be rounded to create a whole integer number, Tie-breaking: If the fraction is less than or equal to .5, the result will round down.
If the fraction is greater than .5, the result will round up.

CLng cannot handle Null values, use Nz() to convert Nulls to a valid number.

Examples

Dim lngDemo as Long

lngDemo = CLng(35000.50)
>35000

lngDemo = CLng(Nz(Me!txtInvoiceNo,0))

“A man is like a fraction whose numerator is what he is and whose denominator is what he thinks of himself. The larger the denominator, the smaller the fraction” ~ Leo Tolstoy

Related:

CBool - Convert to boolean
CByte
- Convert to byte
CCur
- Convert to currency (number)
CDate
- Convert to Date
CDbl
- Convert to Double (number)
CDec
- Convert to Decimal (number)
CInt - Convert to Integer (number)
Number Data Types
Convert to Base 36
Nz - Detect a NULL value.


© Copyright SS64.com 1999-2014
Some rights reserved