Command button auto select after pressing Enter

B

Bafa

I have a user form with 5 text boxes to fill in and 3 command buttons
Command1 button that needs to be pressed for a function and the
Commend2 labeled "Next" command2 labeled "Back". When I fill in th
first text box and press Enter it automaticly places my curser in th
next text box, and so on. After I fill in the last text box it the
auto selects the Command1 button which perfoms a function for the user
But it does not go ahead to command2 button, which would take them t
the next page when pressed or hutting Enter. I have figured out how t
order them using the TabIndex setting, but can't make it auto select th
next command button after hiting enter on the first command button. I
there a way to do this
 
G

Gary Keramidas

maybe something like this

Private Sub CommandButton1_Click()
Me.CommandButton2.SetFocus
End Sub
 
B

Bafa

Thanks again Gary. My project is coming together nicely. Hopefully I
will have it completed by tomorrow and can take it to my interview for
a promotion Wednesday.
 
N

NickHK

For these controls, you have a few option to make life easier for the user.

..TabStop=True - Included in the cycle of controls (order determined by
TabIndex) when Tab is pressed.
..Default=True - Simulate a click on this control when Enter is pressed
..Cancel=True - Simulate a click on this control when Esc is pressed

NickHK
 

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