I have several text fields that are set to either number or currency data types. I want the fields to only accept number entries. When the user types in text, nothing happens.
Any know how I could do that?
Thanks
You could try using the On Key Press command to check if the key pressed is a numeric key or not, like this:
If Not IsNumeric(Me.TextBox1) Then
'code to delete the Text entry
End If
but i've had problems with this, as editing the Field highlights the entire entry which means that every time a key is pressed it highlights the current text, so that when you press another key it overrides it, (if that makes sense!)
You should try using the Input Mask property for the field.
There are a few different options that you will have with this property on how to handle this, your best bet is to read about Input Mask first in the help if you don't have any experience with them.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.