Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting an "enter" key pressed to exit a control

Status
Not open for further replies.

shallman

Technical User
Jul 21, 2003
22
0
0
US
I have a form with 3 controls, an unbound control for entering a customer "account" number, and two control buttons, one for "Lookup" and one for "Cancel". When the user enters a number in the "account" text box and clicks on "Lookup" a query is run, if clicks on "Cancel" the form is closed. Currently, if a number is entered and the user presses the enter key, control is moved to the "Lookup" button.

Instead the "enter" key moving control to the "Lookup" button, I want the "enter" key to run the query. In other words, entering a number and hitting "enter" has the same effect as entering a number and clicking "Lookup". As it sits now, the user has to hit the enter key twice, or select the "Lookup" button.

I am looking for the proper method of detecting and traping the pressing of the enter key from the "account" textbox.

I have tried several pieces of code in the "On Exit" event of the text box but can't seem to trap the enter key.

Any help appreciated.
Thanks
 
Look for an event up_key and check the key, I believe. I will check back later after I have done that.


Rollie E
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top