Set focus in mult-nested controls

J

JeffSomDal

I have the following:

Main form with 1 Tab Control with 8 pages.
On Tab_Page1, I have 4 combo boxes and a subform.
The subform contains a Tab Control with 4 pages; each TabPage corresponds to
each of the 4 combo boxes .

What I am trying to accomplish:

When I select one of the combo boxes, I would like the corresponding TabPage
in the subform to be "displayed" and the focus returned back to the combo box.

(i.e. show Tab_Page1 when combobox1 is selected, show Tab_Page2 when
combobox2 is selected, show Tab_Page3 when combobox3 is selected; show
Tab_Page4 when combobox4 is selected)

I assume this will required code in the "On Got Focus" of each combo box?
 
A

Arvin Meyer [MVP]

In the Enter or GotFocus event for each of the combo boxes, use some code
like:

Me.TabControlName.Pages(0).SetFocus

Which will set focus to the first tab, or:

Me.TabControlName.Pages(1).SetFocus

Which will set focus to the second tab
 

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