Printable Version of Topic

Click here to view this topic in its original format

UtterAccess Forums _ Access Modules _ How To Safeguard An Inputbox For Numbers Only

Posted by: fizzy1 Oct 11 2018, 10:06 PM


Perhaps a confusing thread title, sorry. I have an inputbox from which I am aiming to collect a number. I know if the box is cancelled or the user hits Enter with no value in there it returns an empty string, so that's easy to immunize against.

But how can I then read the input and throw back a message / cancel out if the input is not a number? I'm so far using CDbl(strInput) to force the input to a Double, but obviously that fails is the input is not a number.


Posted by: Doug Steele Oct 11 2018, 10:17 PM

Try using the IsNumeric function.

Posted by: fizzy1 Oct 11 2018, 10:26 PM

Hi Doug,

That's perfect, thanks. I'd found an older but it doesn't have that simple method in there.