Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / September 2004

Tip: Looking for answers? Try searching our database.

Validating number input

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Laurie - 18 Sep 2004 00:54 GMT
Hi All

This seems very simple but how would you validate that a user
has entered just numbers into a form's textbox.
That is 1234 is good while Wer234 and 234ddd is bad. I would prefer
to use VBA if possible

Thanks
Laurie
fredg - 18 Sep 2004 01:49 GMT
> Hi All
>
[quoted text clipped - 5 lines]
> Thanks
> Laurie

Make the field a number datatype.
Signature

Fred
Please only reply to this newsgroup.
I do not reply to personal email.

Salad - 18 Sep 2004 17:22 GMT
> Hi All
>
[quoted text clipped - 5 lines]
> Thanks
> Laurie

See IsNumeric in help.

Ex:
If IsNumeric("123") Then...
x = 123
If IsNumeric(x) Then...
Douglas J. Steele - 18 Sep 2004 18:33 GMT
Just be aware that things like 123E4 and 543D2 will be found as Numeric by
the IsNumeric function.

(1230000 and 54300 respectively)

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> > Hi All
> >
[quoted text clipped - 12 lines]
> x = 123
> If IsNumeric(x) Then...
Salad - 18 Sep 2004 20:32 GMT
> Just be aware that things like 123E4 and 543D2 will be found as Numeric by
> the IsNumeric function.
>
> (1230000 and 54300 respectively)

Interesting.  I can understand somewhat the E4 thinking the power of.
What is the "D"?
PC Datasheet - 18 Sep 2004 20:57 GMT
Notice that Doug's example is "D2" ---
2 Decimal places

--
                                       PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
                             resource@pcdatasheet.com
                                www.pcdatasheet.com

> > Just be aware that things like 123E4 and 543D2 will be found as Numeric by
> > the IsNumeric function.
[quoted text clipped - 3 lines]
> Interesting.  I can understand somewhat the E4 thinking the power of.
> What is the "D"?
Laurie - 20 Sep 2004 09:17 GMT
> Notice that Doug's example is "D2" ---
> 2 Decimal places
[quoted text clipped - 13 lines]
> > Interesting.  I can understand somewhat the E4 thinking the power of.
> > What is the "D"?

Thanks for all the replies. Just after posting the message I realised
that defining the datatype was all I needed however the comment on
IsNumeric took me by surprise. It is amazing what a seemly simple
question can raise.

Thanks
Laurie
user_5701 - 21 Sep 2004 19:27 GMT
If the only thing that field can accept is numbers only, use an
InputMask on the field.

Defining the datatype will still allow them to enter letters, but I
think it will throw an error when they leave that field if they typed
in something that the datatype in the table won't allow. (such as a
letter in a Number datatype field)

> > Notice that Doug's example is "D2" ---
> > 2 Decimal places
[quoted text clipped - 21 lines]
> Thanks
> Laurie
Laurie - 26 Sep 2004 02:38 GMT
Hi

Yes a datatype was not the answer so I decided to redesign the
database and
use a text field in place of the number field I was trying to
validate. This ended up being a much better solution overall.

Cheers
Laurie
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.