Others

Add Previous and Next Buttons to an Access Combo Box

Amos GikundaAmos Gikunda Nov 14, 2026 868 views

Question details

Add buttons that move to the previous or next item in a Microsoft Access combo box.

Add Previous and Next Buttons to an 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.
Before you start

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.

Solution 1Recommended

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.

1
Name the controls

Open the form in Design View. On the Property Sheet, name the combo box cboEmployee and add two command buttons named cmdPrevious and cmdNext.

2
Add the Previous code

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

3
Add the Next code

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

4
Test the buttons

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.

Use VBA buttons to select adjacent combo box items
Updating related controls: Assigning the combo box value in VBA does not automatically run its After Update event. If that event updates other controls or a subform, move the shared logic into a separate procedure and call it from both button events.
Free Microsoft Office alternative

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.

Organize employee lists in WPS Spreadsheets.Open and edit Microsoft Excel XLSX and XLS files.Use a familiar interface for everyday document and spreadsheet tasks.Move existing Office files into a lightweight suite.
microsoft office alternative - wps office

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.