Export (0) Print
Expand All
Expand Minimize

ComboBox.ListRows Property (Access)

You can use the ListRows property to set the maximum number of rows to display in the list box portion of a combo box. Read/write Integer.

expression .ListRows

expression A variable that represents a ComboBox object.

The ListRows property holds an integer that indicates the maximum number of rows to display. The default setting is 16. The setting for the ListRows property must be from 1 to 255.

Note Note

Microsoft Access sets the ListRows property automatically when you select Lookup Wizard as the data type for a field in table Design view.

You can set the default for this property by using a combo box's default control style or the DefaultControl property in Visual Basic.

If the actual number of rows exceeds the number specified by the ListRows property setting, a vertical scroll bar appears in the list box portion of the combo box.

The following example uses the ListCount property to find the number of rows in the list box portion of the CustomerList combo box on a Customers form. It then sets the ListRows property to display a specified number of rows in the list.

Public Sub SizeCustomerList() 
 
 Dim ListControl As Control 
 
 Set ListControl = Forms!Customers!CustomerList 
 With ListControl 
 If .ListCount < 8 Then 
 .ListRows = .ListCount 
 Else 
 .ListRows = 8 
 End If 
 End With 
 
End Sub

Community Additions

ADD
Show:
© 2014 Microsoft