A list box displays up to 32,767 items in a list, one of which the user can select.
The BeforeUserChanged and AfterUserChanged events run each time the user selects an item in the list box, or presses the up arrow or down arrow key to move to a different list item. All other VBA field events function normally for a focusable list box field.
VBA uses a numeric value (1 to n) when referencing list box fields. In most cases, the value corresponds to the position of an item in the list. You cannot reference the name of the item in the list, nor can you rearrange, remove or add items to a list box using VBA.
In certain instances, the position of an item in a list box doesn’t necessarily correspond to its numeric value. This is especially true if the list is sorted in alphanumeric order. To determine the correct value, select the item in the list, then view the field’s Value property using the Visual Basic Editor’s Property sheet.
The following example sets the default selection in the Currencies list box when the Multicurrency Access Setup window opens:
Private Sub Window_AfterOpen() Currencies = 8 'Selects Z-US$ End Sub