Selecting menu numbers with return key

Gazza2

Registered User.
Local time
Today, 08:30
Joined
Nov 25, 2004
Messages
184
I have a form menu as a startup page and i would like my users to select a number and press the enter key to open up a new form and close the menu.
The menu numbers and descriptions are done with labels, the users have a text box at the bottom were they will type in the number of the new form that they want to edit then they will press enter and it will take them to the new form and close the menu.

Any help will be appreciated
 
Last edited:
one way of doing this is to use the OnKeyDown event of your form and do a search on this forum for the word KeyCode.
 
Code I used

Thanks for the advice both of you but I entered the following code into both the onkeydown event and the afterupdate event for the text box one at a time and made sure that keyprieview for the form is set to yes but still couldnt get it to work.

private sub Text1_afterupdate()
select case keycode
case vbKey1 + vbKeyreturn
keycode = 0
docmd.openform"form1",acnormal
docmd.close"menu"
end select

end sub

this is only an example to select the first menu item and all that happens is that the number disappears.
 
I entered the code as you have written it and changed the names of the forms to the names of miine but it is still not working.

But i have just noticed that the number does not actually disappear it moves up a line so if i press the delete key the number reappears.

thanks for your help so far.
 
Is the "Enter Key Behaviour" property of the text box in question set to "Default", or "New Line In Field" ?
 
is the code similar for using letters to open a new form or is it completely different.

The reason being that in some forms that display data the users may have to open another form from within that form and they want to use the first letters of the form name that they want to open.
 

Users who are viewing this thread

Back
Top Bottom