Not completely sure what you exactly want.
Here is my code to disable some user input and enable other
Instead of keypress use keydown
Select Case KeyCode
Case 0 to 7
KeyCode = 0
Case Is = 8
KeyCode = KeyCode
Case 9 to 31
KeyCode = 0
Case 32 to 127
KeyCode = KeyCode
Case 128 to 255
KeyCode = 0
End Select
--or--
Better off putting it in a module so you can call it any time
-- start module--
Function DisEsc(KeyCode As Integer) As Integer
Select Case KeyCode
Case 0 to 7
DisEsc = 0
Case Is = 8
DisEsc = KeyCode
Case 9 to 31
DisEsc = 0
Case 32 to 127
DisEsc = KeyCode
Case 128 to 255
DisEsc = 0
End Select
--end module--
--Form Code--
Private Sub Form_KeyDown(KeyCode As Integer)
KeyCode = DisEsc(KeyCode)
End Sub
get your ascii values at
http://www.asciitable.com/