Re: Testing for numeric input
- From: John F. <JohnF@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 22 Sep 2008 20:31:01 -0700
Thanks, Allen.
To clarify: It's actually a code, not a 'number' as such:
"15" would be OK, "15." would not; "15.0" would be OK, "1.78" would not (has
to have 2 digits to the left of the decimal).
And it all has to be text, not a number. In C#, as I recall, there's a 'not
a number' function or you can try to convert the text into a numeric value
and if that fails, that flags the textbox value as invalid. Nothing like that
in Access VBA, I guess.
I was thinking about testing each key-down to see if it was numeric or a
decimal point but that's beyond my skill. If I know everything that's entered
meets that basic test and I'm assured that users aren't entering alphabetic
characters, I could live with that.
Best,
johno
"Allen Browne" wrote:
By "2 digits to the left", I assume you mean the number must be at least 10..
The "3 digits to the right" is not reallly meaningful for floating point
data types, and you don't mention negatives, so perhaps you could try
setting these properties:
Format: General Number
Validation Rule: >= 10
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"John F." <JohnF@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:D5ABDA1C-42B5-4B69-AB3C-F7062BA3B38B@xxxxxxxxxxxxxxxx
Hi:
I'd like to ensure that all input into a textbox, 'tboxNumber', is numeric
and/or a decimal point. The input must be text, not a numeric type.
How is that best done? The number has to have at least 2 digits to the
left
of the decimal, but can have up to 3 digits on either side of the decimal
point. It does not have to have a decimal point; if there is a decimal
there
can be 0 - 3 digits after the decimal.
Thank you.
johno
- Follow-Ups:
- Re: Testing for numeric input
- From: Allen Browne
- Re: Testing for numeric input
- References:
- Testing for numeric input
- From: John F.
- Re: Testing for numeric input
- From: Allen Browne
- Testing for numeric input
- Prev by Date: Read Mail from a POP3 Acount
- Next by Date: Re: Testing for numeric input
- Previous by thread: Re: Testing for numeric input
- Next by thread: Re: Testing for numeric input
- Index(es):
Relevant Pages
|