populating listbox by adding values from another listbox

npatil

Registered User.
Local time
Today, 04:54
Joined
Mar 4, 2011
Messages
39
Hey All,

I have a listbox in one form: lst_filter_option1 which has several items. I would like to add each item as a filter to another listbox : lst_Filter. Now, based on the items added to lst_Filter, I would like to subsequently run a query.

Also, the items in lst_filter_option1 are "Values" added manually.

How do I achieve this? How do I choose the RowSource values from the first listbox and add them as values to the second listbox?

Thanks in advance,
 
can you try using Forms!yourForm.lst_filter_option1.Column(n) where n is the column you want to use. Then, after changing the value in your list, in the OnChange event, requery the other listbox.
Then in the query, reference the values in the columns you want to reference from lst_Filter in the same way.

hth,
..bob
 
Sorry, but I did not quite understand tht.

However, I tried this, but i am getting run time error for object not detected.

Private Sub lstFilter_Option_1_Click()
Dim listarrary, strcriteria As Variant
Dim list1 As Variant

listarray = Array("tirewidth", "aspectratio", "rimradius", "SS")
list1 = Array(0)

If Me.lstFilter_Option_1 = "tirewidth" Then
strcriteria = lstFilter.AddItem(list1)
DoCmd.OpenForm "Results", , , strcriteria
 
well, I am using lstFilter on the same form,
Dim listarrary, list1
...
....
If Me.lstFilter_Option_1 = "list1" Then
lstFilter.AddItem(list1)

It works now.
 
just saw that you got it going...
Glad you figured it out.
..bob
 

Users who are viewing this thread

Back
Top Bottom