Microsoft KB Archive/166295: Difference between revisions
(importing KB archive) |
m (Text replacement - """ to """) |
||
Line 51: | Line 51: | ||
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.<br /> | 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.<br /> | ||
<br /> | <br /> | ||
This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the | This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the "Building Applications with Microsoft Access 97" manual. | ||
</div> | </div> | ||
Line 72: | Line 72: | ||
RowSource: Employees<br /> | RowSource: Employees<br /> | ||
ColumnCount: 2<br /> | ColumnCount: 2<br /> | ||
ColumnWidths: .25 | ColumnWidths: .25";1"<br /> | ||
Visible: Yes<br /> | Visible: Yes<br /> | ||
Left: 1 | Left: 1"<br /> | ||
Top: .25 | Top: .25"<br /> | ||
Width: 1.75 | Width: 1.75"<br /> | ||
Height: 1.3 | Height: 1.3"<br /> | ||
List Box:<br /> | List Box:<br /> | ||
Name: List2<br /> | Name: List2<br /> | ||
RowSource: Customers<br /> | RowSource: Customers<br /> | ||
ColumnCount: 2<br /> | ColumnCount: 2<br /> | ||
ColumnWidths: 0 | ColumnWidths: 0";1.25"<br /> | ||
Visible: No<br /> | Visible: No<br /> | ||
Left: 1 | Left: 1"<br /> | ||
Top: .25 | Top: .25"<br /> | ||
Width: 1.75 | Width: 1.75"<br /> | ||
Height: 1.3 | Height: 1.3"<br /> | ||
Command Button:<br /> | Command Button:<br /> | ||
Name: Command0<br /> | Name: Command0<br /> | ||
Line 122: | Line 122: | ||
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. | 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. | ||
<ol> | <ol> | ||
<li>Perform steps 1 and 2 in the | <li>Perform steps 1 and 2 in the "Resolution" section of this article.</li> | ||
<li><p>Set the command button's OnClick property to the following event procedure:</p> | <li><p>Set the command button's OnClick property to the following event procedure:</p> | ||
<pre class="codesample"> Private Sub Command0_Click | <pre class="codesample"> Private Sub Command0_Click |
Latest revision as of 11:02, 21 July 2020
Article ID: 166295
Article Last Modified on 1/19/2007
APPLIES TO
- Microsoft Access 97 Standard Edition
This article was previously published under Q166295
Moderate: Requires basic macro, coding, and interoperability skills.
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.
This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to the "Building Applications with Microsoft Access 97" manual.
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.
- Start Microsoft Access and open the sample database Northwind.mdb.
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]Set the command button's OnClick property 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
- 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.
- 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.
STATUS
Microsoft has confirmed this to be a problem in Microsoft Access 97.
MORE INFORMATION
Steps to Reproduce Problem
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.
- Perform steps 1 and 2 in the "Resolution" section of this article.
Set the command button's OnClick property 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
- Switch the form to Form view. You can select information from the Employees table in the List0 list box with no problems.
- 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.
Additional query words: see through transparent
Keywords: kbbug kbprogramming kbui KB166295