multi tab condition

  • Thread starter Thread starter cmichaud
  • Start date Start date
C

cmichaud

I am using a combo box to hide or show tab pages. I have what is below
set up so far and it is working fine. The problem is i have another
combo box following this one. And i dont know how to incorporate it.
It has two choices: active or inactive. For both cases (6 and 7) if
the member is active i want to still display [club membership] if they
are inactive i want to hide it. Does anyone know how i do this. i am
truly stuck. tks. caleb


in the forms current event
Me![Personal Info].Visible = True
Me![Additional Info].Visible = False
Me![Medical].Visible = False
Me![Contacts].Visible = False
Me![Training].Visible = False
Me![History].Visible = False
Me![References].Visible = False
Me![Club Membership].Visible = False

In the after update event
Select Case PositionID
Case "6"
Me![Medical].Visible = True
Me![Contacts].Visible = True
Me![Training].Visible = True
Me![Club Membership].Visible = True
Case "8"
Me![Additional Info].Visible = True
Me![Training].Visible = True
Me![History].Visible = True
Me![References].Visible = True
Me![Club Membership].Visible = True
 
This will work:

In the after update event

If Me.cboOtherCombo = 6 Then
Select Case PositionID
Case "6"
Me![Medical].Visible = True
Me![Contacts].Visible = True
Me![Training].Visible = True
Me![Club Membership].Visible = True
Case "8"
Me![Additional Info].Visible = True
Me![Training].Visible = True
Me![History].Visible = True
Me![References].Visible = True
Me![Club Membership].Visible = True
End Select
Else
In the after update event
Select Case PositionID
Case "6"
Me![Medical].Visible = False
Me![Contacts].Visible = False
Me![Training].Visible = False
Me![Club Membership].Visible = False
Case "8"
Me![Additional Info].Visible = False
Me![Training].Visible = False
Me![History].Visible = False
Me![References].Visible = False
Me![Club Membership].Visible = False
End Select
End If
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 
arvin

i am confused.

the first combobox is poisition id (the choices being youth (6) or
adult (8))....it contains the afterupdate event i showed you.
the second combobox status id (the choices being active(27) or
inactive(28)).

i am trying to get tab page 'club membership' to hide if the user
selects inactive in the second combobox.
i entered the code you gave me in the afterupdate event of statusid.
is this the right combo box?
it is performing the same as before. hiding all the pages

if you got time could you elaborate some?
thanks much
 
try adding the following procedure to your form's module, as

Private Sub isTabSetup()

Me![Personal Info].Visible = True
Me!Medical.Visible = (Me!PositionID = 6)
Me!Contacts.Visible = (Me!PositionID = 6)
Me![Additional Info].Visible = (Me!PositionID = 8)
Me!History.Visible = (Me!PositionID = 8)
Me!References.Visible = (Me!PositionID = 8)
Me!Training.Visible = (Me!PositionID = 6 Or _
Me!PositionID = 8)
Me![Club Membership].Visible = (Me!StatusID = 27)

End Sub

then call the procedure from the form's Current event, as

Private Sub Form_Current()

isTabSetup

End Sub

also call the procedure from the AfterUpdate event of the PositionID control
and the StatusID control. the code "toggles" the Visible property of each
tabpage to True or False depending on the value in those two controls, so it
will work the same for all three events - and ensure that the appropriate
tabs are visible as you move to new records and also between existing
records.

note: if the PositionID and StatusID fields are Text data type, you'll need
to change the toggle code for each tabpage slightly, as

Me!Medical.Visible = (Nz(Me!PositionID, "") = "6")
Me!Contacts.Visible = (Nz(Me!PositionID, "") = "6")
Me![Additional Info].Visible = (Nz(Me!PositionID, "") = "8")
Me!History.Visible = (Nz(Me!PositionID, "") = "8")
Me!References.Visible = (Nz(Me!PositionID, "") = "8")
Me!Training.Visible = (Nz(Me!PositionID, "") = "6" Or _
Nz(Me!PositionID, "") = "8")
Me![Club Membership].Visible = (Nz(Me!StatusID, "") = "27")

also note that if there is no code in your form that ever sets the Visible
property of the [Personal Info] tab to False, then you can remove

Me![Personal Info].Visible = True

from the code entirely. just make sure the Visible property is set to True
*in the form design window*.

hth
 
Back
Top