Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.
This sets the combo to the next item (list index plus one), wrapping to zero after the last item (modulo list count). The event can also be cancelled, but that is rarely useful.
Private Sub MyCombo_DblClick(Cancel As Integer) With MyCombo .Value = .ItemData((.ListIndex + 1) Mod .ListCount) End With End Sub
Each combo box in my application then gets the following “On Dbl Click” property:
Function ComboNextItem(cbo As ComboBox, Optional OrNull As Boolean) ' Selects the next item in the passed combo box. ' Set 'OrNull' to True (or 1) to select Null after the last item. If OrNull Then ' let Null happen by overflow of list index With cbo .Value = .ItemData(.ListIndex + 1) End With Else ' wrap list index to list count With cbo .Value = .ItemData((.ListIndex + 1) Mod .ListCount) End With End If End Function
|How to create an Access database for a business overview||2,546|
|How to close an Access report by pressing Escape (Esc) key||750|
|MS Access VBA error 3146 when using a string longer than 128 characters in a WHERE clause with SQL Server||379|
|Round elements of a sum to match a total||220|