list box

  • Thread starter Thread starter nath
  • Start date Start date
N

nath

I have two list boxes. One is populated by a sql
statement, the other i want to carry over selections from
list box1 can anyone advise of the code to do this please.
 
I assume you mean that you want to limit the contents of the second list
based on the first.

What you need to do is use the AfterUpdate event on the first listbox and
then write code to change the recordsource of the second listbox to an SQL
command that will fetch the rows you require.

--
Jonathan Blitz
AnyKey Limited
Israel

"When things seem bad
Don't worry and shout
Just count up the times
Things have worked themselves out."
 
1. Both listboxes need to be multi-select.
2. Your table needs a Yes/No field named Selected.
3. The left listbox needs a query rowsource based on the table in 2. Selected
in the query need a criteria of False.
4. The right listbox needs a query rowsource based on the table in 2. Selected
in the query need a criteria of True.
5. In the left listbox, you need code in the AfterUpdate event that sets
Selected to True for the record you picked, then requery the left listbox and
finally requery the right listbox.
6. In the right listbox, you need code in the AfterUpdate event that sets
Selected to False for the record you picked, then requery the right listbox and
finally requery the left listbox.

After you have made all your selections, you need code to get the Selected items
from the right listbox and process them. When processing is complete, you need
to set Selected to False for all fields in the table where Selected is True.
 
Back
Top