Preventing "-" after a number

JennJenn

Registered User.
Local time
Today, 15:41
Joined
May 15, 2002
Messages
13
I am trying to prevent a user from entering a "-" sign at the end of a number in a field. For example, if the 81- was entered instead of -81. Am I on the right track with this:
If Mid(FieldName, Length(FieldName) -1) then FieldName.Value = "-" & Mid(FieldName, 1, Length(FieldName)-1)
End If
 
One way would be to put this in the kepress event of your text box:

If KeyAscii = 45 Then
If InStr(1, Text0.Text, Chr(45)) Then
KeyAscii = 0
Else
KeyAscii = 0
Text0.Text = Mid(Chr(45), 1) & ext0.Text
End If
End If
 
Check Right([Field],1) <> "-" in the BeforeUpdate event of the field, then rework it (or warn the user to fix it and Cancel).
 
I realized that all I had to do is create a customized input mask(#99.99;0) that would only allow the user to enter a "-" sign in the front of the number. Using this, the user cannot put -00.00...only 00.00). Thanks for your help!
 

Users who are viewing this thread

Back
Top Bottom