trying to limit text

F

francisco

I want to limit a text data type to only recieve numbers.
Is this possible?
And if I try using the number data type, how can I limit
it to only 4 spaces.

Thanks in advance
 
J

John Vinson

I want to limit a text data type to only recieve numbers.
Is this possible?

Sure. Use an Input Mask of

0000

(all zeros); the user will be required to type four numeric digits and
no other characters will be accepted.

Use

9999

if you want them to be able to type zero to four digits. Note that the
text string will be LEFT justified and may not sort numerically if you
do this.
 
M

May

Under the input mask of the control, key in 9999
it should work

May
MCP in Access and SQL Server
 
M

May

or Try the following code under keypress event
If KeyAscii >= 48 And KeyAscii <= 57 Then
MsgBox "yes" ' do your work here
Else
KeyAscii = 0
End If

May
MCP in Access and SQL Server
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top