CDec

Function that converts an expression into a Decimal (Number.)

Syntax
      CDec (expression)

The Decimal data type stores numbers from -10^28-1 through 10^28-1.
If an ADP file is used (with SQL Server) this increases to -10^38-1 through 10^38-1

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

Unlike most similar functions, you cannot use CDec() in a Query, the workaround is to write a custom function.

Examples

Dim dblDemo as Double

dblDemo = CDec(12 * 0.000001)

“People have a peculiar pleasure in making converts, that is, in causing others to enjoy what they enjoy, thus finding their own likeness represented and reflected back to them” ~ Johann Wolfgang von Goethe

Related

CBool - Convert to boolean
CByte
- Convert to byte
CCur
- Convert to currency (number)
CDate
- Convert to Date
CDbl
- Convert to Double (number)
CInt - Convert to Integer (number)
CLng
- Convert to Long (number)
Number Data Types
Convert to Base 36
Nz - Detect a NULL value or Zero Length string.


 
Copyright © 1999-2024 SS64.com
Some rights reserved