Although, this performs to my requirements, the message which is displayed
when any characters other than numerals are entered, is not to my liking as
this message typically is an Access generated message.
What I need is to restrict the user to entering only the following:
a. Numbers.
b. The decimal point.
c. The plus or the minus signs.
Any other characters which the user might enter should not be accepted
and/or even displayed in the text box at all.
Any help on this issue is highly solicited.
Yours sincerely,
Shotodru
Have a look at the keydown event, you can create code there to
accomplish that.
Something like :
Private Sub Tekst0_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case Chr(KeyCode)
Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
Case "."
Case Else
KeyCode = 0 'Cancels the input
End Select
End Sub
And perhaps validate the whole input to see if it's numeric with the
IsNumeric function