We help IT Professionals succeed at work.

Hiding a subform with a multiple column listbox

atreidies
atreidies asked
on
392 Views
Last Modified: 2013-11-28
I want to hide my subform based on the choice in a multiple column list box.

My list box has two headings Name and Number
based on the name selected i want to use a select case statement to hide or unhide the subform.
Comment
Watch Question

Hamed NasrRetired IT Professional
CERTIFIED EXPERT

Commented:
If the control that contains the subform is calld x, then in the listbox after update hide/unhide the control

    Me!x.Visible = False

Author

Commented:
I know the statement to hide it, what i dont know is how to make that happen based on which record is selected. I mean to use a select statment to hide or unhide it.
Hamed NasrRetired IT Professional
CERTIFIED EXPERT

Commented:
<I mean to use a select statment to hide or unhide it.>
Can you explain more?
A select statement won't hide the control!

Author

Commented:
my list box has 2 columns
what I want to do is add a select case statment to the after update of the list box. that will hide the subform. My issue is the the list box has 2 columns how do i attach the select case to one of those headings.
eg.
select case (record selected)
case Todd
   hide subform
case Mike
   hide subform
end select
Hamed NasrRetired IT Professional
CERTIFIED EXPERT

Commented:
Private Sub lstBox_AfterUpdate()
    Select Case lstBox.Column(0)
        Case Is = "Todd"
            Me!frmY.Visible = False
        Case Is = "Mike"
            Me!frmY.Visible = True
        End Select      
End Sub
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.