Problem managing Enter Key behavior in a userform

B

belerephone

I have a userfrom that contains three combo box lists and 8 text boxes.

My user uses the comboboxes to select from lists of values. They then enter
data in to the text boxes.

Finally they select a save command button to save all the data to a row in a
worksheet.

I have set the tab order to go through the three combo boxes first then the
text boxes. I have set the Text box EnterKeyBehavior proprty to False.
Everything is fine if the user uses a mouse or the Tab Key.

My problem is that if the user presses the Enter Key at any time the
comboboxes are live the form immediately trys to Save. I want the Enter key
behavior for the combo boxes to set focus to the next combobox or Text box
but when I use the following code all that happens is I cannot edit the
initial combobox, focus immediately goes to the one referenced in the code

Private Sub cbbLocation_Enter()
cbbFYear.SetFocus
End Sub

Any help would be appreciated.
Thanks
Peter
 
C

Coza

One possibility owul be to have the SAVE Button set to:
CommandButton1.enabled = false
UNTIL ALL Comboboxes and Textboxes contain values.
You could use the :
CommandButton1.enabled=True on the last Textbox to enable it again.

Corey....
 

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