UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> How To Safeguard An Inputbox For Numbers Only, Access 2010    
 
   
fizzy1
post Oct 11 2018, 10:06 PM
Post#1



Posts: 477
Joined: 26-May 11



Hi,

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.

Thanks,
Toby.

--------------------

thanks,
fizzy1.
Go to the top of the page
 
Doug Steele
post Oct 11 2018, 10:17 PM
Post#2


UtterAccess VIP
Posts: 21,970
Joined: 8-January 07
From: St. Catharines, ON (Canada)


Try using the IsNumeric function.

--------------------
Doug Steele, Microsoft Access MVP (2000-2018)
http://www.accessmvp.com/DJSteele/AccessIndex.html
Co-author: Access Solutions: Tips, Tricks, and Secrets from Microsoft Access MVPs, published by Wiley
Co-author: Effective SQL: 61 Specific Ways to Write Better SQL, published by Addison-Wesley Professional
Technical Editor: Access 2010 Bible, Access 2013 Bible, Access 2016 Bible, all published by Wiley
Technical Editor: SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, 4th Edition, published by Addison-Wesley Professional
Go to the top of the page
 
fizzy1
post Oct 11 2018, 10:26 PM
Post#3



Posts: 477
Joined: 26-May 11



Hi Doug,

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

Thanks,
Toby.

--------------------

thanks,
fizzy1.
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    23rd October 2018 - 11:50 PM