Hello,
I'm trying to convert numbers entered into a text field to an integer value. I have tried:
number(textfield)
CInt(textfield)
but nothing seems to work. Any ideas?
Thanks,
Kevin
Hello,
I'm trying to convert numbers entered into a text field to an integer value. I have tried:
number(textfield)
CInt(textfield)
but nothing seems to work. Any ideas?
Thanks,
Kevin
Danial Riddle forwarded me this link https://stackoverflow.com/questions/7638458/converting-a-string-to-a-number where I noticed this note. I had forgotten the limited range for an integer. Clng conversion worked as expected for me.
To avoid potential hard errors in case the value is not numeric, I would first evaluate if the text is numeric by using the IsNumeric function.
If IsNumeric(textfield) Then numericfield = CLng(textfield) End If
*Community Hub is the new name for Sage City