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