Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Overlapping List Box Controls Show Through One Another


View products that this article applies to.

This article was previously published under Q197594
Moderate: Requires basic macro, coding, and interoperability skills.

↑ Back to the top


Symptoms

When your form has two or more list box controls, one on top of the other, you can see portions of the control on the bottom when you click the one on top.

↑ Back to the top


Resolution

You can work around this behavior by setting the Visible property of the underlying list box control(s) to False when not in use. The following example uses a command button to toggle the Visible properties of two list box controls.
  1. Start Microsoft Access and open the sample database Northwind.mdb.
  2. Create a new form not based on any table or query in Design view. Be sure to add the list box controls in the order listed below so List2 is on top of List0:
       Form: frmListBox
       ------------------------
       Caption: Test List Boxes
    
       List Box:
          Name: List0
          RowSource: Employees
          ColumnCount: 2
          ColumnWidths: .25";1"
          Visible: Yes
          Left: 1"
          Top: .25"
          Width: 1.75"
          Height: 1.3"
       List Box:
          Name: List2
          RowSource: Customers
          ColumnCount: 2
          ColumnWidths: 0";1.25"
          Visible: No
          Left: 1"
          Top: .25"
          Width: 1.75"
          Height: 1.3"
       Command Button:
          Name: Command0
          Caption: Toggle Boxes
          OnClick: [Event Procedure]
    					
  3. Set the OnClick property of the command button to the following event procedure:
    Private Sub Command0_Click
       'Toggle the Visible property of each list box
       List0.Visible = Not List0.Visible
       List2.Visible = Not List2.Visible
    End Sub
    					
  4. Switch the form to Form view. A list of ID numbers and last names from the Employees table is displayed in the List0 list box.
  5. Click the Toggle Boxes button. A list of company names from the Customers table is displayed in the List2 list box.
Note that as you toggle the list boxes and click items inside them, the items in the invisible list box do not appear.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

↑ Back to the top


More information

Steps to Reproduce Behavior

If you overlap two list boxes and toggle the Visible property of just one of them, you can see portions of the underlying list box control. This behavior does not occur in earlier versions of Microsoft Access.
  1. Follow steps 1 and 2 in the "Resolution" section of this article.
  2. Set the OnClick property of the command button to the following event procedure:
    Private Sub Command0_Click
       ' Toggle the Visible property of the top list box
       List2.Visible = Not List2.Visible
    End Sub
    					
  3. Switch the form to Form view. You can select information from the Employees table in the List0 list box with no problems.
  4. Click the Toggle Boxes button. Note that as you scroll up and down the List2 list box and click company names, you see portions of the List0 list box underneath. This is because the Visible property of the List0 list box is still set to True.

↑ Back to the top


Keywords: KB197594, kbpending, kbbug

↑ Back to the top

Article Info
Article ID : 197594
Revision : 2
Created on : 6/24/2004
Published on : 6/24/2004
Exists online : False
Views : 467