LIMITING WHAT TABS ARE DISPLAED ON TAB CONTROL

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a main form with a combo box. I want the tab displayed in the tab
control to depend on the selection made in the combo box. Ideally I would
also be able to restrict access to the other tabs on the form as well.

Any ideas?


Ed
 
Create a column in you combobox that holds the name of the page you
want made visible. This might come from your table or from a value
list. Then in the AfterUpdate of the combobox, put this code:

Dim objPage As Page
' Make all pages invisible.
For Each objPage In Me.MyTabCtl.Pages
objPage.Visible = False
Next
' Set the selected page to Visible. This assumes that the page
name column is the second column in the combobox..
Me.MyTabCtl.Pages(Me.cboCombo.Column(1)).Visible = True

HTH,
Barry
 
Back
Top