Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tab control: How do I navigate from to a subform to another subform

Status
Not open for further replies.

smsmail

Programmer
Aug 11, 2010
105
US
Hello,

I have a tab control, the first page of the tab control is a menu, all other pages of the tab control are bound subforms.
From within a tab/subform, I want to be able to navigate to another tab/subform of a tab control in the onclick event of a button on the subform.

I have tried setting the tab control's value property to the specified page I want to navigate to (i.e. TabCtl0 = 4), but it does not work.

What am I doing wrong?

Thanks in advance for your help!
 
try
Code:
Me.Tab.Value = [i]index of page that you want[/i]
 
How are ya smsmail . . .

PWise code would work if focus were on the mainform, however you've just hit a button on one of the subforms ... so focus resides there.

Try the following ([blue]you[/blue] substitute proper names in [purple]purple[/purple]):
Code:
[blue] Dim frm As Form
 
 [green]'Set mainForm Object
 '(Me.CommandButtonName.Parent.Parent.Name) is MainForm Name![/green]
 Set frm = Forms(Me.[purple][b]CommandButtonName[/b][/purple].Parent.Parent.Name)
 
 [green]'Goto page of subform[/green]
 frm![purple][b]TabControlName[/b][/purple].Pages("[purple][b]PageName[/b][/purple]").SetFocus
 
 [green]'Set focus to specific control[/green]
 frm![purple][b]OthersubFormName[/b][/purple].Form.[purple][b]ControlName[/b][/purple].SetFocus
 
 Set frm = Nothing[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top