- Community Pick
- Experts Exchange Approved
- Editor's Choice
This was a smart interface choice by the Access development team: you almost never need to double-click on a word in a combo box to select it, for example, and the feature is especially useful for combo boxes with short lists: “Yes/no”, “not indexed / indexed (with duplicates) / indexed (without duplicates)”, etc. It speeds up design and avoids having to create check boxes for properties that are really just flags.
To implement the same feature in your own applications, one line of code is enough (or three here, for readability).
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.
It's not much code, but I use it so often that I normally create this function in the module dealing with the user interface:
Each combo box in my application then gets the following “On Dbl Click” property:
= ComboNextItem(MyCombo)
or, in the rare cases where Null makes sense,
= ComboNextItem(MyCombo,1)
This reduces the clutter in the form modules: no need for highly redundant event handlers for each and every combo on the form.
I hope you will find this trick useful!
Markus G Fischer
(°v°)
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
This article is part of the EE-book unrestricted Access.
by: harfang on 2010-06-16 at 16:56:11ID: 15843
(^v°)
Select allOpen in new window