Turn off the delete key

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to turn off the delete and backspace keys in a field on my form.
I was able to turn off the backspace key by using the code below, however I
can not figure out how to turn off the delete key. In the code below I am
using the ASCII code for the key. I have not found the ASCII code for the
delete key, I have found it for the delete command (127)

Private Sub TransCode_KeyDown(KeyCode As Integer, Shift As Integer)
'turns off the backspace key
Select Case KeyCode
Case 8
KeyCode = 0
End Select
End Sub
 
Dawnecia,

46

Alternatively, you can use the contstants, e.g.
Select Case KeyCode
Case vbKeyBack, vbKeyDelete
KeyCode = 0
End Select
 
Thanks Steve, it worked.


Steve Schapel said:
Dawnecia,

46

Alternatively, you can use the contstants, e.g.
Select Case KeyCode
Case vbKeyBack, vbKeyDelete
KeyCode = 0
End Select
 
Back
Top