Re: Testing for numeric input

Tech-Archive recommends: Fix windows errors by optimizing your registry



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


.



Relevant Pages

  • Re: Cobol Myth Busters
    ... than just TRUNC (wich has 3 flavors on IBM zSeries). ... The following is the information on "comapring data types" for the Enterprise ... Performance considerations for comparing data types ): ... using 18 digits: packed decimal is 74% faster than binary ...
    (comp.lang.cobol)
  • Re: This calculation is just wrong / computer cant count!
    ... question stands - how do I (or perhaps I should ask what data types should I use) to program this decimal mathematics? ... We do not understand the rationale behind your desire to compare the computer arithmetics to "real math" or decimal arithmetics. ... I then take the final result and format it myself to the number of decimal digits I need to present to the user. ...
    (microsoft.public.vc.mfc)
  • Re: Entering 18 digit number in Excel
    ... The number of digits that may be used is, in general, determined by the ... hardware data types, in this case the Double data type. ... In addition, there are data types not tied to the hardware, e.g,, the ... However, numbers are stored using the Double type, largely fo reasons of ...
    (microsoft.public.excel)
  • Re: conversion problem
    ... >I've checked the Substring returns only digits ... Hi RoiDD, ... What are the data types of @i and @j? ...
    (microsoft.public.sqlserver.programming)
  • Re: Testing for numeric input
    ... johno. ... PS I hope it's a reasonable hour in Perth: my brother lives there and it's ... You may be able to use an input mask to indicate what digits are required, ... Perth, Western Australia ...
    (microsoft.public.access.formscoding)