Hiding a subform with a multiple column listbox

Posted on 2008-09-30
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.
Question by:atreidies
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 30

Expert Comment

ID: 22606937
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 Comment

ID: 22607042
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.
LVL 30

Expert Comment

ID: 22607087
<I mean to use a select statment to hide or unhide it.>
Can you explain more?
A select statement won't hide the control!
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 22607255
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.
select case (record selected)
case Todd
   hide subform
case Mike
   hide subform
end select
LVL 30

Expert Comment

ID: 22607415
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

Accepted Solution

atreidies earned 0 total points
ID: 22614228
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.

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
run FileCopy code from a string 6 50
PowerPivot (or MS Access ) -- Opening & Closing Balance 21 52
ODBC failure when running MSACCESS query a second time. 5 49
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

736 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question