Enter key Event

  • Thread starter Thread starter Jordan
  • Start date Start date
J

Jordan

If I want an event to occur when I hit the Enter key
while in a field, what Event do I put the procedure in?
 
It is not 100% clear here if you want to know that the user is all done with
the field, and has hit enter to move on.

It your case is the above, then I would suggest you use the after update
event.

If you want to change the behaviors of the enter key in a field, then there
is a setting in the "other" tab that will change the behaviors of the enter
key one setting = go to next field,

and the other setting = Enter = new line of text.

If your problem NOT solved by either of the above, then you can trap, and
process the entry key in the on-key down event.

You can use:

If KeyCode = vbKeyReturn Then
KeyCode= 0
msgbox "you pressed the enter key..ha ha!"
end if
 
Well, I created a Search Dialog box form. I have two
fields which the user can put a value to search for, but
I want to make is so that if the focus is on either
field, pressing the enter key would do the same as
clicking the Search button on the form (ie. display the
results). That code didn't seem to work.
 
Well, then likely the after update event is what you are looking for.

You can also use zero code, and simply set the "default" property of the
search button to yes. If you do that, then hitting enter is the same as
clicking on the on the button .
 
Back
Top