VARTYPE( ) Function

See Also

Returns the data type of an expression.

Syntax

VARTYPE(eExpression [, lNullDataType])

Returns

Character

Arguments

eExpression

Specifies the expression for which the data type is returned. VARTYPE( ) returns a single character indicating the data type of the expression. The following table lists the characters that VARTYPE( ) returns for each data type:

Character returned Data type
C Character or Memo
N Numeric, Integer, Float, or Double
Y Currency
L Logical
O Object
G General
D Date
T DateTime
X Null
U Unknown

Note   If eExpression is an array, the first element in the array is evaluated.

lNullDataType

Specifies if VARTYPE( ) returns the data type when eExpression contains the null value. If lNullDataType is true (.T.), VARTYPE( ) returns the data type of eExpression. If lNullDataType is false (.F.) or omitted, VARTYPE( ) returns 'X', indicating that eExpression contains the null value.

Remarks

VARTYPE( ) is similar to the TYPE( ) function, but VARTYPE( ) is faster and does not require quotation marks to enclose the expression for which the data type is returned.

VARTYPE( ) returns “U” if you specify a variable that doesn’t exist.