Dynamicly Populate Listbox

yippie_ky_yay

Registered User.
Local time
Today, 16:57
Joined
Jul 30, 2002
Messages
338
Hello group,

I've just discovered that the addItem option from VB is not in VBA, so I was hoping someone could suggest an alternative for me.

Basicly, I wanted the user to be able to select multiple records and then run a query based on those selections. My idea was to have a listbox containing all records, then on the double click event, something like:
lstSelectedList.AddItem = lstListAllRecords

Then, my query could run based on the entries contained in lstSelectedList.

Of course, a completely different solution would be welcome as well!

thanks,

-Sean

UPDATE:
I have temporarily solved this by creating another table to store the values that I would like to see in my listbox and making it the source for my listbox. This seems like an awful waste though - plus I have to delete all the records in the temp table on my way out. Any other ideas? Thanks!
 
Last edited:
Try using this....


Place a list box onto your form, go to its properties, on the DATA tab, Select <Value List> from the <Row Source Type>.

I assume ur listbox name is list1, so you can add new items to the list using this techniqu...


list1.rowsource=list1.rowsource & NewText & ";"

NewText is a variable containing a new value, or it could be a number. It works just like Additem of VB.

Thanx
 
Thanks Everblue - works great now!

And thank you for the suggestion Pat - I still have lots to learn about all the properties, so all info is very helpful!

-Sean
 

Users who are viewing this thread

Back
Top Bottom