Add Previous and Next Buttons to an Access Combo Box
Question details
Add buttons that move to the previous or next item in a Microsoft Access combo box.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- An Access form displays employee names or other items in a combo box, and the user wants to navigate the list with buttons.
- Observed behavior
- The buttons should select adjacent items without moving beyond the first or last available item.
Open the form in Design View and confirm that the combo box has a populated row source. For the code below, set Column Heads to No and use a bound column containing unique values, such as employee IDs.
Use VBA buttons to select adjacent combo box items
Use this approach to navigate the combo box list by its displayed order and stop at either end.
In Access, ListIndex identifies the selected position but is read-only. The code uses ItemData to assign the bound value of the target row instead of trying to change ListIndex directly.
If list order matters, set the combo box row source to a query with an ORDER BY clause. The example assumes the bound column is not set to 0.
Open the form in Design View. On the Property Sheet, name the combo box cboEmployee and add two command buttons named cmdPrevious and cmdNext.
Select cmdPrevious, open its Event tab, and choose [Event Procedure] for On Click. Click the build button and add this procedure in the form's VBA module: Private Sub cmdPrevious_Click() Dim i As Long Me.cboEmployee.SetFocus If Me.cboEmployee.ListCount = 0 Then Exit Sub i = Me.cboEmployee.ListIndex If i < 0 Then i = 0 ElseIf i > 0 Then i = i - 1 End If Me.cboEmployee.Value = Me.cboEmployee.ItemData(i) End Sub
Set cmdNext's On Click property to [Event Procedure], open the code builder, and add this procedure: Private Sub cmdNext_Click() Dim i As Long Me.cboEmployee.SetFocus If Me.cboEmployee.ListCount = 0 Then Exit Sub i = Me.cboEmployee.ListIndex If i < 0 Then i = 0 ElseIf i < Me.cboEmployee.ListCount - 1 Then i = i + 1 End If Me.cboEmployee.Value = Me.cboEmployee.ItemData(i) End Sub
Save the form, switch to Form View, and click Previous and Next. With no selection, either button selects the first item; at either boundary, the selection stays on the current item.

Navigate with the keyboard
Use the arrow keys when dedicated buttons are unnecessary.
Work with employee lists in WPS Office
WPS Office is a free, lightweight alternative for working with office documents and spreadsheets. Its familiar interface and Microsoft Office format compatibility make it easy to move existing files, although it does not replace Access forms or fix Access VBA.

Frequently Asked Questions
Why not set the combo box ListIndex directly?
In Access, ListIndex is read-only. Read it to find the current position, then assign the target row's bound value with cboEmployee.ItemData(index).
What happens if the combo box has no selected item?
ListIndex is -1 when no item is selected. In the example, either button selects the first item if the list is not empty.
How can I control the order of the items?
Open the combo box Property Sheet and edit its Row Source query. Add an ORDER BY clause for the field you want to sort, such as the employee name.
Why doesn't my subform update when I click a navigation button?
A VBA assignment to the combo box does not automatically trigger its After Update event. Call the code that updates the subform from each button event, or place shared update logic in a separate procedure.




