Search list box

Hi EE
I have the following
Dim i As Long
Dim Intnum
Intnum = Me!txtOrg
With Me!lstCompany
    For i = 0 To .ListCount - 1
        If .Column(2, i) Like Intnum Then
            .Selected(i) = True
            Exit For
        End If
    Next i
End With
Me!lstCompany.SetFocus

example. I have a list box of client details I need to search for names beginning with first two or three characters of a name. I have a name called Donards and would like to enter Don for a search. With the above code I have to enter the full name Donards for it to work.
Any help appreciated

chestera
chesteraAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongCommented:
try this...

Dim i As Long
Dim Intnum
Intnum = Me!txtOrg
With Me!lstCompany
    For i = 0 To .ListCount - 1
        If instr(1, .Column(2, i), Intnum) > 0 Then
            .Selected(i) = True
            Exit For
        End If
    Next i
End With
Me!lstCompany.SetFocus
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chesteraAuthor Commented:
Ryan Chong

Thank you Ryan works like a charm

lan
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.