how to export listbox values to a table

B

Brian Bartley

All,
I'd like to have the user choose some items from combo boxes which causes a
listbox to fill up with values. Then the values from the listbox need to be
appended to a table. I can access the values in the listbox with the
listbox.rowsource property, but they appear as one big long string. If the
listbox has two columns and eight rows the rowsource string will have 16
items, all delimited with the semicolon.

I'd like to have a way to parse that rowsource string into 8 rows to add to
an existing table. The split function doesn't work because the delimiter
appears after each item, there's no way to tell Split() where a row ends or
begins. Thanks,

Brian
 
D

Dan Artuso

Hi,
Here is code that gives you each entry seperately, you can do what you want with them.

Dim i As Integer

For i = 0 To Me.lstNames.ListCount - 1
MsgBox Me.lstNames.Column(0, i)
MsgBox Me.lstNames.Column(1, i)
Next i
 

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