Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Mar 2004
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi all,
    I've been looking around for a couple of days -and can't find what I need. I know this must be easy.

    I have a form with 2 combo boxes. [Combo1] and [Combo2] for this purpose.

    I would like to hide [Combo2] until item 2 (of 5) is selected in [Combo1].
    If items 1, 3,4,5 are chosen. Combo2 needs to remain hidden.
    Only item 2 selection from Combo1 should show Combo2.

    It's intention is to show 'reasons for a patient ending a Cardiac Rehab Program' :Completed, Dropped out, Death etc.
    If 'Dropped-out' is chosen, we need to show the combo box for the reasons why they dropped out.
    Thanks as always,
    Vicky

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    You could use the After Update event of the first combo box:

    Code:
    Private Sub Combo1_AfterUpdate()
      Me.Combo2.Visible = (Me.Combo1.ListIndex = 1)
    End Sub
    (The list index starts counting at 0, so the second item has list index 1.)

    You should also do this in the On Current event of the form, so that the second combo box is shown/hidden correctly as the user moves from record to record:

    Code:
    Private Sub Form_Current()
      Me.Combo2.Visible = (Me.Combo1.ListIndex = 1)
    End Sub

  3. #3
    Star Lounger
    Join Date
    Mar 2004
    Posts
    92
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='795681' date='30-Sep-2009 15:48']You could use the After Update event of the first combo box:

    Code:
    Private Sub Combo1_AfterUpdate()
      Me.Combo2.Visible = (Me.Combo1.ListIndex = 1)
    End Sub
    (The list index starts counting at 0, so the second item has list index 1.)

    You should also do this in the On Current event of the form, so that the second combo box is shown/hidden correctly as the user moves from record to record:

    Code:
    Private Sub Form_Current()
      Me.Combo2.Visible = (Me.Combo1.ListIndex = 1)
    End Sub
    [/quote]


    That's perfect...
    Thank you as usual!
    Vicky

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •