Link to home
Start Free TrialLog in
Avatar of BobSue
BobSue

asked on

Find values in a combo box while typing returning results with Like

How do I setup a combo box that is populated with MAC addresses to ignore the pre-amble that finds the closest match after each character typed or scanned?

Sample:
As the user types 232 it will find the closest match below:

TagMacTable
14EB000000013B
14EB0000000232
14EB00000004E9

Thanks for your help!
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

In your form's Design View, click on the combo box, then right-click:Properties.
On the Data tab, set the AutoExpand property to Yes.
Avatar of BobSue
BobSue

ASKER

jimhorn,
I already have that set and that doesn't give me what I am looking for.
I think this is a better description....  I want the list in the combo box to be filtered on the fly to match the characters that are typed. Thus, if I type 232 in the combo box with the sample list below, it would only  show 14EB0000B23200 and 14EB0000000232 as values to choose from.

14EB0000B23200
14EB000000013B
14EB0000000232
14EB00000004E9
That only works with the left-most characters, not any characters within the value.  Sorry.
ASKER CERTIFIED SOLUTION
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just to make clear - this depends upon your definition of the phrase
"finds the closest match"
In that filtering a list is very different to navigation.
So whereas Auto Expand merely advances you down the list to the first match based on the beginning of the text - filtering reduces the list to only those results which match the requested text.

If you like things somewhat varied - the "Combo Filtering" demo on this examples page offers several ways to filter a combo as you type.  (Depending upon how you think the data is best retrieved).

The first method is the simplest.  And, looking at his now, is probably similar to Jeff's example above.
(Some of the ADO code might seem a tad involved - that's just me working around a MS bug with ADO recordsets fildered assigned to list controls in an Access form).
You can ignore all the ADO methods if you like. :-)
Of course - if what you want is navigation and not filtering then that's different (and far trickier).
With a listcontrol as the slave (as in Boag's example) it's pretty trivial - you can set the value of that control without consequence, however in a combo you naturally would then complete the entered text (that you're busy entering).

IMO filtering makes more sense anyway.
Avatar of BobSue

ASKER

Good eveing all!
LPurvis your suggestions well taken and very much appreciated. However, Jeff was what I was looking for. FYI, I added code to the other controls in my form to change the visible property to false for the list box once another control had focus.

Thanks so much!!!

Bob