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

Escape Key Not Working On Certain Fields

Status
Not open for further replies.

jhaganjr

IS-IT--Management
Dec 11, 2002
62
US
What I consider "normal" behavior is when data is typed into a field on a form or a selection is made in a combo box, pressing the Escape key once will Undo the typing or the selection.

For most fields on my form the Escape key does just that.

But there are several fields on the form where pressing Escape does NOT undo what was just done in that field. Whatever changes were made to the field are still there after pressing escape. Only the Undo command will get rid of the field changes ... but then that Undoes the entire record.

I can't find any kind of setting that's causing the Escape key to behave differently for certain fields on the form.

Anybody have any clue? Thanks.

Joe
 
Don't know what causes it, but this code inserted in the keypress event of the field will fix it:

Private Sub Text0_KeyPress(KeyAscii As Integer)


If KeyAscii = 27 Then
Me.Text0 = Me.Text0.OldValue
End If


End Sub
 
Thanks vbajack,

That's useful and on the money.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top