I have a function to prevent users typing non numerics into field requiring pure numbers.
It uses the On KeyDown event to read the ASCII code for the key which has been pressed if the key entered has an ASCII code falling between 48 & 57 (corresponding to 0 through 9) then it is accepted, else it is rejected.
The problem is on one persons machine it will not accept the number 1 when it is pressed. On further investigation, when he presses the number 1 his machine returns ASCII 97 which should be letter "a". I don't need help on my code, but I have no idea what is going on with his machine and how I can get it to return ASCI 49 when he presses 1.
Any help appreciated.
It uses the On KeyDown event to read the ASCII code for the key which has been pressed if the key entered has an ASCII code falling between 48 & 57 (corresponding to 0 through 9) then it is accepted, else it is rejected.
The problem is on one persons machine it will not accept the number 1 when it is pressed. On further investigation, when he presses the number 1 his machine returns ASCII 97 which should be letter "a". I don't need help on my code, but I have no idea what is going on with his machine and how I can get it to return ASCI 49 when he presses 1.
Any help appreciated.
Code:
10010 If (KeyCode >= 48 And KeyCode <= 57) Or KeyCode = 8 Or KeyCode = 9 Or KeyCode = 46 Then
'do nothing
10030 Else
10040 strError = "The values entered must be pure numeric i.e characters 0 through to 9. The value you have entered has been cancelled"
10050 End If