Hiding a subform with a multiple column listbox

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.
LVL 1
atreidiesAsked:
Who is Participating?
 
atreidiesConnect With a Mentor Author Commented:
Ive tried a few variations of this:

Private Sub List6_AfterUpdate()
Select Case List6.Column(0)
    Case Is = "0164"
    Me!EmploymentTypeDescriptionssubform.Visible = False
End Select
End Sub

Without success and took a different route....but thanks for the help.
0
 
hnasrCommented:
If the control that contains the subform is calld x, then in the listbox after update hide/unhide the control

    Me!x.Visible = False
0
 
atreidiesAuthor 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.
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

 
hnasrCommented:
<I mean to use a select statment to hide or unhide it.>
Can you explain more?
A select statement won't hide the control!
0
 
atreidiesAuthor 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
0
 
hnasrCommented:
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.