On the Fly Search with ComboBox (1 Viewer)

Weekleyba

Registered User.
Local time
Today, 04:27
Joined
Oct 10, 2013
Messages
586
I would like to know how to create a 'on the fly' search for a combobox.
This would be similar to a search engine, say Google's.
The Auto Expand property only works if you are typing in the first characters.
So for example, if you had a field entry in the combobox drop down of:
"Project Repair EPDM Roof", you could type in "Pro" and it would show "Project Repair EPDM Roof" but if you typed in "EPDM", nothing shows up.
I've found some older posts on this topic (2011) but it got very complicated with lots of code.
Any suggestions on how to accomplish this?
Thanks for you help!
 

sneuberg

AWF VIP
Local time
Today, 02:27
Joined
Oct 17, 2014
Messages
3,506
I've attached one that someone (arnelgp I think) uploaded a while back. It seems to work ok.

They're all going to have code. This one doesn't have too much.
 

Attachments

  • AutoComplete-AutoSuggest-Example.accdb
    388 KB · Views: 347

Weekleyba

Registered User.
Local time
Today, 04:27
Joined
Oct 10, 2013
Messages
586
I'm not good with VBA but after reviewing Allen Browne's code, I see you can limit the list in the combobox by only retrieving data after the first 3 characters are typed in. However, this is still only looking at the first characters in the field name and not the whole name.
I'm not sure how Instr() works. Read up on it and it will retrieve the position of the character. Not sure how that would work. Sorry, still a novice here.
Need more help...
 

RuralGuy

AWF VIP
Local time
Today, 03:27
Joined
Jul 2, 2005
Messages
13,826
If Instr() returns non zero value your string in in the search.
 

Weekleyba

Registered User.
Local time
Today, 04:27
Joined
Oct 10, 2013
Messages
586
Thanks sneuberg! That's exactly what I was looking for.
Now to adapt it to my form.
Have a great day, since you made mine.
 

wheeledgoat

Registered User.
Local time
Today, 02:27
Joined
Feb 12, 2019
Messages
16
I've attached one that someone (arnelgp I think) uploaded a while back. It seems to work ok.

They're all going to have code. This one doesn't have too much.

Steve, I registered an account here just to thank you. I realize it's bad form to resurrect threads but the content is still quite relevant in 2019, and a hearty THANKS is in order here. Saved me a lot of time!
 

Users who are viewing this thread

Top Bottom