Listbox additem

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?
 
L

Linq Adams via AccessMonster.com

If you're having a problem with looping, we really need to see the code
you're using to loop.
 
R

rc51wv

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top