ComboBox.ListRows property (Access)

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.

Syntax

expression.ListRows

expression A variable that represents a ComboBox object.

Remarks

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

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.

Example

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

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.