chestera
asked on
Delete key
Hi
I am using the keydown event keycode = vbkeyDelete when I click delete it deletes the record great. I want to some how before deleteing ensure user wants to really delete with a yes or no if yes delete if no cancel.
chestera
I am using the keydown event keycode = vbkeyDelete when I click delete it deletes the record great. I want to some how before deleteing ensure user wants to really delete with a yes or no if yes delete if no cancel.
chestera
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Put the following code into the forms BeforeDelConfirm event
dim txtResponse as string
txtResponse = MsgBox("Are You Sure?", vbYesNo, "Deleting Record")
If txtResponse = vbYes Then Response = vbYes Else Cancel = True
Or if you are wanting to do it in a field on a KeyDown (or similar) event use the following
Dim txtresponse As String
If KeyCode = vbKeyDelete Then
txtresponse = MsgBox("Are You Sure?", vbYesNo, "Deleting Record")
If txtresponse = vbYes Then DoCmd.RunCommand acCmdDeleteRecord
End If
dim txtResponse as string
txtResponse = MsgBox("Are You Sure?", vbYesNo, "Deleting Record")
If txtResponse = vbYes Then Response = vbYes Else Cancel = True
Or if you are wanting to do it in a field on a KeyDown (or similar) event use the following
Dim txtresponse As String
If KeyCode = vbKeyDelete Then
txtresponse = MsgBox("Are You Sure?", vbYesNo, "Deleting Record")
If txtresponse = vbYes Then DoCmd.RunCommand acCmdDeleteRecord
End If
ASKER
faz136
Thanks for your reply but rockiroads works fine
chestera
Thanks for your reply but rockiroads works fine
chestera
ASKER
rockiroads
Many thanks just what i wanted. never thought of the if statement so simple. sure you have heard of the KISS principle
chestera
Many thanks just what i wanted. never thought of the if statement so simple. sure you have heard of the KISS principle
chestera
Keeping it sweet and simple - thats my philosophy - do the sexy work afterwards :)
get it working first of course!
get it working first of course!
ASKER
rockiroads
:)
:)
ASKER
Thanks will get back to you
chestera