Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deactivate DELETE button on the keyboard

Status
Not open for further replies.
Oct 28, 2003
50
MY
Hi....

Anybody knows how to lock the DELETE button function and the BACKSPACE button function on the keyboard? I need to disable these two key stroke so that the user can only do the deletion by clicking the Delete button on the form.....I have to force the user to use the delete button on the form because there are some coding that need to take place under the DELETE button.

Please help....
 
AutoKeys macro (probably the ONLY macro worth keeping)...

Macro Name: {DEL}
Action: MsgBox
Message: "He he can't you just use the button?"

This will disable the Del key throughout the application.

For a specific form or control, you have to trap the key in the KeyDown event.

Good luck

[pipe]
Daniel Vlas
Systems Consultant

 
this codes works...i got it from another forum:

Private Sub txtDesc_KeyDown(KeyCode As Integer, Shift As Integer)
If ((KeyCode = vbKeyDelete) Or (KeyCode = vbKeyBack)) Then

KeyCode = 0

End If
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top