|
Question : Hide / Unhide Combo Boxes using Visible property Conditionally
|
|
Hello, I need to generate a report using multiple selections from drop downs in a form. The report can contain 3 status types (i.e pending, bidding, secured, etc.) or just one. I have created a form with three Combo Boxes, each with the same row source. I will call them Status1, Status2, and Status3. The row source is as follows. (table containing 1 Column - "Status")
"The first row is empty" Bidding Budget Hold Lost No Bid Pending Prospect Secured Target Projects
Task: 1. When the user pulls up the form, I only want Status1 showing (visible) with an empty value.
2. If they select a value from the Status1 Drop down, then I want the Status2 ComboBox to become visible.
3. If Status1 and Status2 have selections made, the Status3 will become visible.
4. If Status1 and 2 are populated and they change 2 back to the empty value, I want the form to completely reset (to step 1).
5. If all three are populated and they remove the selection from Status 2, I want the the form to completely reset (to step 1).
The correct way for the user to get a report with three statuses would be to select from each box from left to right.
|
|
Answer : Hide / Unhide Combo Boxes using Visible property Conditionally
|
|
You're looking for cascading combos, of a sort. These are typically done in the Afterupdate event of your combos:
Sub Combo1_AfterUpdate() Me.Combo2.Visible = Nz(Me.Combo1, "") <> "" End Sub
Sub Combo2_AfterUpdate() If Nz(Me.Combo2, "") <> "" Then Me.Combo3.Visible = True Else Me.Combo3 = vbNullString Me.Combo1.SetFocus Me.Combo2.Visible = False Me.Combo3.Visible = False End Sub
|
|
|
|