Populating List Box From Query

mcarlin

New member
Local time
Today, 14:37
Joined
Aug 17, 2005
Messages
8
Hi -

I've searched the forms for any solutions/ideas but I'm still not sure.

I want to pass a search parameter from a form to a query then use the query results to populate a multi-column list box. So far, I can pass the parameter to the query and generate results, however, I want the query results sent to a listbox rather than create a new window.

I set up the listbox to receive results from the query, but when the form opens the listbox is already populated with arbitrary query results. I want the listbox to be empty when the form is opened, I submit a parameter to a query, and the listbox fills with the results

Additionally, once the listbox is populated, I want to clear the listbox but am having the error: The RowSourceType property must be set to 'Value List' to use this method.

Thanks in advance!

MC
 
Hi,

I'm trying to do the same thing with query + listbox (I'm having 2 comboboxes on the form, 2 tables and one query for the 2 tables, and I want the query results to be sent to a listbox ) but I can't figure out how, can you help me with it?

10x
 
use the query as the row source of the list box and requery the listbox from the after update events of the comboboxes.

Shout back with control names and things if you want more help

Peter
 
I'm still new, how do you requery a listbox after a COMBO BOX updates? I know its code of some sort but not sure what that is?

Wulf
 
You do it in the after Update event of the combo box. inthe property sheet for the combo box goto events and hit the build button for 'After Update' and select 'Code Builder'

This will open up the code window for you. you need code like

Private Sub MyCombo_AfterUpdate()
Me.MyListBox.Requery
End Sub

HTH

Peter
 

Users who are viewing this thread

Back
Top Bottom