How can I GetFocus for a specific field after escape key is pressed?

  • Thread starter Thread starter John Bildy
  • Start date Start date
J

John Bildy

Hi,

I have an order form. If user presses the escape key the form clears of
data. How can I get the cursor to go to a sepcific field in the form after
the escape key is pressed?

Thanks for helping.
 
turn on the "keypreview" feature in the form properties,
and trap for keycode = 27 in the OnKeyUp event
 
If this is Access 2000 or later, you could use the Undo event of the form,
e.g.:

Private Sub Form_Undo(Cancel As Integer)
Me.SomeContol.SetFocus
End Sub

That should work unless there is some event that is preventing focus moving
from another control.
 
Back
Top