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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not able to capture Keypress for (13)

Status
Not open for further replies.

gamesman

Programmer
Oct 8, 2001
223
US
I have a form on which resides a single textbox and a few hidden fields. In an attempt to save keystrokes for the user I would like to capture the KeyPress Chr(13) - the Enter key - to initate my code. It's not working.

It maybe that I shouldn't be using 13. I'm not sure. Any assistance would be appreciated. I'm using access 2000.

I want the Enter Key to initate a validation of the hidden fields and either open another form or cancel.

Gamesman
jhughes@barbhosp.com
MT(ASCP), MCP, CIW, CNA
 
Did you set the form level property ‘Key Preview’ to Yes and set the ‘On Key Press’ to an event procedure. In the ‘On Key Press’ event procedure, check for ASCII = vbKeyReturn ( which is 13). If it is. Place your validation code there.

Tom
 
Thanks. Apparently the error was in my validation code. It's working ok.
Gamesman
jhughes@barbhosp.com
MT(ASCP), MCP, CIW, CNA
 
Another way to do it would have been to add a command button to your form and set it's Default Propery to True. Then pressing Enter would automatically trigger the command button's Click event . . . _________
Rott Paws

...It's not a bug. It's an undocumented feature.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top