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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
danlevansConnect With a Mentor Commented:
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
 
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
All Courses

From novice to tech pro — start learning today.