press enter

W

wd1153

hi,

I have a textbox and a button. the textbox is for user to
enter searching criteria, after the user click on button,
the code runs to search records according the textbox
content. My question is how do I make it beheave like:
user either click on the button or just press 'enter' key
after entering some search criteria in textbox to make it
run the code. Currently, after I press enter, the focus
move to the button, then I have to press again to make it
run. I am sure it has to do with keypress event of the
txtbox. But how?
 
O

OzPete

expanding on what William suggests, put the (command button's 'on click'
event) code in the after update event of the textbox... so that your textbox
will perform what your command button does, and you can then get rid of your
command button too!

OzPete
 

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