DEL key in listbox

IfButOnly

Registered User.
Local time
Today, 17:13
Joined
Sep 3, 2002
Messages
236
I'm sure this is simple, but I can't get it to work.

I want to use the DEL key on a selected item in a listbox to initiate a procedure which, after checking with the user, will delete the item. However, I cannot get my code to recognise that the DEL key has been pressed.

I'm using Access 2000, Windows 98 on a Toshiba Laptop.

Thanks
 
activated command with del key

On the form load you have to set the keypreview to true
Then on the keydown you can define all keys and do an action.
See example below.
Hopefully is this to help for you

Private Sub Form_Load()
Me.KeyPreview = True
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyDelete
MsgBox "Delete file????"
End Select
End Sub

Top Filip
 
FilipT -- Thanks a bunch, worked great.
 

Users who are viewing this thread

Back
Top Bottom