Listbox additem

  • Thread starter Thread starter rc51wv
  • Start date Start date
R

rc51wv

I'm using:

Me.lstErr2.AddItem (strErrIDSingle(intCount) & "," & strErrDesc)

to add an item to a list box. The list box has two columns with the first
being invisible and the second being seen by the user. This works fine for
one entry but when I loop the code and try to add multiple items, there are
spaces in the list box or it's showing the first item in the second column
and not the showing the second item.

I've been searching and I don't know if I'm using the wrong syntax or what.
I believe it's not seeing "strErrDesc" as the index because the VBA hints
only highlight index when I add in another comma after "strErrDesc".

Can anyone offer any guidance here?
 
intCount = 1

Do Until strErrIDSingle(intCount) = ""

strErrDesc = DLookup("[ErrDescription]", "tblUrgentError", "[ErrID] = '"
& strErrIDSingle(intCount) & "'")

Me.lstErr2.AddItem (strErrIDSingle(intCount) & "," & strErrDesc)
Me.lstErr1.RemoveItem (strErrIDSingle(intCount))

intCount = intCount + 1

Loop
 
Back
Top