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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ESC key Cancels data entry

Status
Not open for further replies.

PercyN

Programmer
May 16, 2007
86
Hi All,
I have a form that is link to a table. On the form, when the user presses the ESC key in the middle of entering a new record, the entire record is canceled and the form resets to new. But I actually have a "Cancel" button which then asks the user to confirm the action before going ahead cancel the current record so I dont need the ESC key cancelling the record entry without asking for confirmation.

Question is how can I stop the ESC from taking this action?

BTW the "Cancel" property of the Cancel button is set to "No" so ma confused as to why this is happening
 
Did you try to set the "Cancel" property of the Cancel button to "Yes" ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi, I just tried that. Still cancels the data entry
 
In Form Design View, set the Form's Key Preview to Yes.

Then use this code

Code:
Private Sub Form_Keydown(KeyCode as Integer, Shift As Integer)
 If Keycode = 27 Then Keycode = 0
End Sub

The Missinglinq

Richmond, Virginia

The Devil's in the Details!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top