Hiding/Unhiding Tabs

  • Thread starter Thread starter Lori
  • Start date Start date
L

Lori

I am using Access 2003.

I have an unbound form that I am using as a customized menu for my database
and have multiple tabs which I have set as visible=no. I have an unbound
combo box on my home tab that asks the user to select the type of project
they are working on and would like the appropriate hidden tab to appear once
a user makes their choice. If they Choose "Private" then one tab will appear,
if they choose "DASNY" then another tab will appear. The problem I have is
that either the tabs do not hide after a change is made OR (with the code
below) only the first "ProjectType" works properly. In this case, "Private"
will switch between hidden and unhidden but none of the other tabs work.

Private Sub ProjectType_Change()
If Me.ProjectType = "Private" Then
Me.Accounting.Visible = True
ElseIf Me.ProjectType <> "Private" Then
Me.Accounting.Visible = False
ElseIf Me.ProjectType = "DASNY" Then
Me.DASNY.Visible = True
ElseIf Me.ProjectType <> "DASNY" Then
Me.DASNY.Visible = False
ElseIf Me.ProjectType = "DDC/EDC" Then
Me.DASNY.Visible = True
ElseIf Me.ProjectType <> "DDC/EDC" Then
Me.DASNY.Visible = False
End If
End Sub

Is there a way to enter multiple options so that when a user switches from
one job type to another the appropriate tab will appear and the unneeded one
will be hidden again?
 
Lori -

Try this:

Private Sub ProjectType_Change()
If Me.ProjectType = "Private" Then
Me.Accounting.Visible = True
Else
Me.Accounting.Visible = False
End If
If Me.ProjectType = "DASNY" Then
Me.DASNY.Visible = True
Else
Me.DASNY.Visible = False
End If
If Me.ProjectType = "DDC/EDC" Then
Me.DASNY.Visible = True
Else
Me.DASNY.Visible = False
End If
End Sub
 
you are wonderful. THANKS

Daryl S said:
Lori -

Try this:

Private Sub ProjectType_Change()
If Me.ProjectType = "Private" Then
Me.Accounting.Visible = True
Else
Me.Accounting.Visible = False
End If
If Me.ProjectType = "DASNY" Then
Me.DASNY.Visible = True
Else
Me.DASNY.Visible = False
End If
If Me.ProjectType = "DDC/EDC" Then
Me.DASNY.Visible = True
Else
Me.DASNY.Visible = False
End If
End Sub
 
Back
Top