Switch between tabs using command button

S

Sam Kuo

Hi, I have a TabControl with 2 subforms in each tab. A command button is
placed in the top subform of each tab. How do I go from one tab to another
upon click of the button? Thanks

Regards,
Sam
 
R

Rick Brandt

Sam Kuo said:
Hi, I have a TabControl with 2 subforms in each tab. A command button is
placed in the top subform of each tab. How do I go from one tab to another
upon click of the button? Thanks

Me.Parent.TabControlName.Value = n

where n is the index value of the desired page.
 
S

Sam Kuo

Hi, I have a TabControl with 2 subforms in each tab. A command button is
Me.Parent.TabControlName.Value = n

where n is the index value of the desired page.

Marvelous! Thanks, Rick
Is it possible to also set focus to top subform? Because currently focus is
always sent to the bottom subform.
 
R

Rick Brandt

Sam Kuo said:
Marvelous! Thanks, Rick
Is it possible to also set focus to top subform? Because currently focus is
always sent to the bottom subform.

The TabPage has its own TabOrder. Just make the top subform first in that
order.
 
Top