Returns the expression converted to a string data type (String).

expressionThe expression to evaluate and convert to a string,

* If the expression passed to the function is outside the range of the data type being converted to, an error occurs.
* You can use the STR function if you want to return a numerical values as a string.
* When the expression is a number this function is identical to the STR function.
* If boolean, converts it to "True" or "False".
* If the expression can be interpreted as a date it returns a string representation of that date.
* For numbers its just the value as a string (for example "25").
* For the Microsoft documentation refer to docs.microsoft.com

Dim dbValue As Double 
dbValue = 100.1234
CStr(dbValue) = "100.1234"

dbValue = 0.123
CStr(dbValue) = "0.123"

Debug.Print CStr("400 pence") //
Debug.Print Str("400 pence") // error

© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited Top