duplicates in listbox ( 5 becomes 25) for working answer

I am using a listbox and additem method.
The database has multiple same names...Ie..White Carol may be in the database 5 times with 5 different criteria. I want to load White Carol in my list box only once. Once loaded I can click on White Carol and display her five different entries by reading the database.

I load using
While not data1.recordset.eof
  list1.additem data1.recordset!lname
wend
data1.recordset.movenext

How do I load White Carol only once leaving the database as it is?

LVL 1
vbWayneAsked:
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.

danlevansCommented:
While not data1.recordset.eof
  if data1.recordset!lname <> LastNameUsed then
    list1.additem data1.recordset!lname
    LastNameUsed = data1.recordset!lname
  end if
  data1.recordset.movenext
wend
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
vbWayneAuthor Commented:
Weird...works for all names except one....it being the second alpha..ie a, b, c

b being the one that's out...have to check the mdb for spaces or something
thanks
Wayne
0
vbWayneAuthor Commented:
Actually it doesn't matter.
I changed the name form
Computer Room Operator to
wComputer
and it still shows up twice.
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
Visual Basic Classic

From novice to tech pro — start learning today.