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

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.
 
C

Chris

turn on the "keypreview" feature in the form properties,
and trap for keycode = 27 in the OnKeyUp event
 
A

Allen Browne

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top