Full Version: Input Mask WildCard. Should be easy
UtterAccess Forums > Microsoft® Access > Access Forms
I have a field in a table which uses a textbox as the data entry method. The field itself is set to currency. I would like to create an input mask that will let the users enter in any amount of numbers they wish but not any letters.
searched the help file but could not find anything useful. Im hoping one of you can can help.
The input mask character 9 is defined as
igit or space (entry not required; plus and minus signs not allowed)
So try something like
Has an input mask.
PS you can trim or extend the 9's before the dp if you want!
Best of Luck
You can set the format of the text box to currency (Select the text box control and set the format to currency). If the user enters a non currency value then they will get a error message.
I saw the 9's thing in the help file for input masks however if i set it as 999999999999999999999.99 and the user only enters 99.99 then it throws back an error.
TW what is DP?
Here I would probably use code in the KeyDown event of the text box. You would need to have another control on the form it can be hidden for it to change focus to when the enter key is pressed.
This code seems to work for me:
If KeyCode >= 96 And KeyCode <= 105 Then
KeyCode = KeyCode - 48
End If
If (KeyCode >= 48 And KeyCode <= 57) Then
Me.Text0.Text = Me.Text0.Text & Chr(KeyCode)
If KeyCode = Asc(vbCrLf) Then
Exit Sub
End If
End If
DP is Decimal Point
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.