Hi,
I have an unbound combo box that I would like to navigate back and forth through the records populated in the combo box. I currently have an advance button thanks to this post here: https://bytes.com/topic/access/answers/649962-advancing-unbound-combo-box. Does anyone know how to do the opposite and create an previous record VBA code?
This is the code I am using for my advance:
and the command button:
Thank you!
I have an unbound combo box that I would like to navigate back and forth through the records populated in the combo box. I currently have an advance button thanks to this post here: https://bytes.com/topic/access/answers/649962-advancing-unbound-combo-box. Does anyone know how to do the opposite and create an previous record VBA code?
This is the code I am using for my advance:
Code:
Function AdvanceCombo(strForm As String, strControl As String) 'This function clears all entries on all listboxes on the form strForm Dim c As Control Dim F As Form Dim I As Long Dim cValue As String Set F = Forms(strForm) Set c = F(strControl) cValue = c.Value For I = 0 To c.ListCount - 1 If c.ItemData(I) = cValue Then c.Value = c.ItemData(I + 1) Next I End Function
Code:
Private Sub cmdnext_Click() AdvanceCombo Me.Name, "cboName" cboName_AfterUpdate End Sub
Comment