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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide select pages of Tab Cotrol

Status
Not open for further replies.

gamisens

Technical User
Apr 29, 2001
15
US
I have a tab cotrol with 3 pages on a form. Under certain conditions I would like only the first page to be visible and hide the other two pages. Can someone help me with the correct syntax for doing this in VBA?

Thank you.
 
I have used the folling on a change event of a combo drop down to display/hide tab control pages.

Private Sub ActionID_Change()
If Me!ActionID.Value = 1 Then 'if action = add then setfocus on page add
TabCtl36.Pages(0).SetFocus
TabCtl36.Pages(0).Visible = True 'and make visible (make others not visible)
TabCtl36.Pages(1).Visible = False
TabCtl36.Pages(2).Visible = False
ElseIf Me!ActionID.Value = 2 Then 'if action = delete then setfocus on page delete
TabCtl36.Pages(1).SetFocus
TabCtl36.Pages(1).Visible = True 'and make visible (make others not visible)
TabCtl36.Pages(0).Visible = False
TabCtl36.Pages(2).Visible = False
ElseIf Me!ActionID.Value = 3 Then 'if action = change then setfocus on page change
TabCtl36.Pages(2).SetFocus
TabCtl36.Pages(2).Visible = True 'and make visible (make others not visible)
TabCtl36.Pages(0).Visible = False
TabCtl36.Pages(1).Visible = False
End If

Or you could use a select case to do the same.
hope this helps.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top