Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Location
    Vancouver, WA
    Posts
    41

    Unanswered: Limiting combobox selection

    I have a combobox with a list of values. I would like users to be able to either:
    1. Select an item from the list with the mouse or cursor keys.
    2. Select an item from the list with the first letter of the item ("a" would select the first item in the list beginning with "a," "a" again would select the second item beginning with "a," etc.)

    I created a convoluted procedure for the KeyDown event, but it's unreliable (depends on subform focus). The NotInList event only fires when the control loses focus, not on each keystroke.

    Am I missing something basic? Any ideas?

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    maybe i am missing something basic! your combo is supposed to behave almost exactly the way you want by default

    1. yes
    2. "a" yes, but "aa" is not the second "axxxxx".

    "a" downarrow does it

    (perhaps you want to check out the properties¦data¦rowsource of your combo and hit the [...] button and add a sorted by)

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Jan 2004
    Location
    Vancouver, WA
    Posts
    41
    Thanks for the quick reply, izy.

    If I have four items in my list, such as "ant, apple, asp, bear," I would like a user to be able to scroll through the "a" items with subsequent presses of the "a" key. The first press of the "a" key selects "ant," the second press selects "apple," the third selects "asp," and the fourth jumps back to "ant."

    The problem is that, as you indicated, the second press of "a" changes the value of the combobox to "aa."

  4. #4
    Join Date
    Feb 2004
    Location
    AZ
    Posts
    12
    This might be a little extreme, but what about using a List Box and adjusting the size to only accomadate 1 line at a time. I believe the charateristics of the listbox satisfy your request. Of course there's some downside to using this as well.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •