CStr

This function converts an expression to a Variant of subtype String.

Syntax

CStr(expression)

Parameters

expression
Any valid expression.

Return Values

Returns a Variant of subtype String.

Remarks

Use CStr to force the result to be expressed as a String subtype.

You can use CStr instead of Str to provide internationally-aware conversions from any other data type to a String subtype. For example, different decimal separators are properly recognized depending on the locale setting of your system.

The following table shows the returns for CStr. The data in expression determines the returns.

If expression is
CStr returns
Boolean A string containing True or False.
Date A string containing a date in the short-date format of your system.
Null A run-time error.
Empty A zero-length string ("").
Error A string containing the word Error followed by the error number.
Other numeric A string containing the number.