Forms: On enter *key* events?

Amaranth

New member
Local time
Yesterday, 18:17
Joined
Feb 5, 2003
Messages
7
I'm a newb, so forgive me. I ran a couple searches across the board, and can't seem to find the answer, so here we go:

Is there any way to activate an event based upon an enter keystroke in a text field? In specific, I'm attempting to run a query from code.

Thanks,
 
2 possible ways I can think of:

1) Set the Default property of a command button on your form to 'Yes', which will execute any code included in its Click event when user hits the 'Enter' key

2) Set the KeyPreview property of the form to 'Yes'. Evaluate for the vbKeyReturn key (the 'Enter' key) in the 'On Key Down' event and then call whatever code it is you want to run when this is True ('Enter' has been pressed).

HTH,
John
 
Thanks!

First suggestion works great. Going to set my newb butt in front of a help file until the second makes sense. Thanks for the help, John.

Thanks again,
 

Users who are viewing this thread

Back
Top Bottom