Setting Values List for ListBox Control (VBA)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Guys.

Let me give you a quick rundown of what I am doing...

Basically, the Form_Load function populates a ListBox with values as the
form loads up. These values are correct and appear in the listbox without any
problems.

However, another event (for a ComboBox, after update) requires that the
values be refilled for the ListBox.

When I print out (i.e. Debug.Print) what the string of values looks
like...it is correct. However, the updated values NEVER show up in the actual
ListBox until I close it and reopen the form.

Can anyone provide assistance?

Thanks in advance, this has been troubling me all afternoon.

David
 
You need a VB function to load the listbox, you call the function whenever
the data changes.
Your listbox rowsource becomes the function name
Its all explained in Access Help. Type in 'Listbox'.

-Dorian
 
basically you need to 'requery' the list box if the list has changed

if this is as a result of a combo changing, then the obvious choice is to do
it in the combo after update event:

sub combo after update

mylistbox.requery

end sub
 

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

Back
Top