Numbers only for text field values

  • Thread starter Harold via AccessMonster.com
  • Start date
H

Harold via AccessMonster.com

I have a field that is for street numbers. I have it set to text, because I
am not going to do calculations on it. I want users to only put in numbers.
How can I restrict users to only inputing numbers?

Thanks,
Harold
 
E

Ed Warren

Don't get yourself "in a wad" when they "don't sort properly".
Also because you are storing text the file size will be larger than if you
store numbers (one byte for each character, rather than 4 bytes for a
number)

Because the 'numbers' are text they will sort as follows.

Number Street
10 Maple Street
101 Maple Street
10101 Maple Street
12 Maple Street

Ed Warren
 
H

Harold via AccessMonster.com

Thank you all !

Lynn said:
Take the following 2 steps:

1. Set the KeyPreview property of your FORM to Yes
2. Add the following colde to the KeyPress event of your textbox control.

If KeyAscii < 48 Or KeyAscii > 57 Then
Beep
End If
I have a field that is for street numbers. I have it set to text, because
I
[quoted text clipped - 4 lines]
Thanks,
Harold
 
L

LGC

How will you handle numbers with a fraction? Not too common but possible:

423 1/2 Elm St

-LGC
 
J

John Nurick

Or numbers with a letter:

423B Elm Street

You may need to ditch the input mask and write VBA code to validate what
the users enter.
 
Top