C
CompleteNewb
I want to be clear, because I know that BASING one listbox on another is a
common question, but this is NOT basing one on the other; What I would like
to do is ADD values from one to the other.
Let's say I have 2 listboxes, one on the left, one on the right. The left
one will have a source of a table. When the user double clicks one value in
this litbox (or highlights it and clicks a button), I would like that value
to appear in the right listbox. If the user doubleclicks another value in
the left listbox, I'd like that value to be ADDED (or perhaps a better word
would be "INCLUDED"; we're not talking arithmetic) to the right listbox (so
now the right listbox shows 2 values).
I'm hoping, in the very near future, to have queries use the values in the
listbox on the right as criteria.
So, when form initially opens, you have:
LeftListbox RightListbox
String1
String2
String3
String4
String5
Then the user doubleclicks the "String4" value (or selects it and clicks a
button). You now see:
LeftListbox RightListbox
String1 String4
String2
String3
String4
String5
Then the user doubleclicks the "String2" value. Now you see:
LeftListbox RightListbox
String1 String4
String2 String2
String3
String4
String5
It would be great if the user could also remove values from the righthand
listbox by doubleclicking them (or highlighting them and clicking a
different button). My plan, here, is to have a query use the strings in the
right listbox as criteria, as in "Select * From [whatever] Where [Field1] =
"String4" Or "String2"", etc., for as many values as have been placed into
the right listbox.
Can anyone help me with this? I've tried having the left listbox update a
table, which the right listbox is based on, and requerying every time a
value is chosen, but this isn't working. Plus it seems like an extra step
to make a table and dynamically update it just to populate a different
listbox. I also started trying to make an array of variables in VBA, but
neither my attempts to add to the array nor my attempts to use that array as
a query criteria in my design grid was working.
Any help with this would be very much apreciated. And, if you think I'm
approaching the whole concept the wrong way, I'm open to better ways of
allowing users to choose several items from a table and use those choices as
the criteria in a query (same field, just every chosen value is added to the
"Or" statement of that field's criteria in the query; so if the user has
doubleclicked "String1" and "String2" and "String3," the query would have in
the criteria line of the field being queried "String1" Or "String2" Or
"String3"
Thanks for reading, and for any help.
common question, but this is NOT basing one on the other; What I would like
to do is ADD values from one to the other.
Let's say I have 2 listboxes, one on the left, one on the right. The left
one will have a source of a table. When the user double clicks one value in
this litbox (or highlights it and clicks a button), I would like that value
to appear in the right listbox. If the user doubleclicks another value in
the left listbox, I'd like that value to be ADDED (or perhaps a better word
would be "INCLUDED"; we're not talking arithmetic) to the right listbox (so
now the right listbox shows 2 values).
I'm hoping, in the very near future, to have queries use the values in the
listbox on the right as criteria.
So, when form initially opens, you have:
LeftListbox RightListbox
String1
String2
String3
String4
String5
Then the user doubleclicks the "String4" value (or selects it and clicks a
button). You now see:
LeftListbox RightListbox
String1 String4
String2
String3
String4
String5
Then the user doubleclicks the "String2" value. Now you see:
LeftListbox RightListbox
String1 String4
String2 String2
String3
String4
String5
It would be great if the user could also remove values from the righthand
listbox by doubleclicking them (or highlighting them and clicking a
different button). My plan, here, is to have a query use the strings in the
right listbox as criteria, as in "Select * From [whatever] Where [Field1] =
"String4" Or "String2"", etc., for as many values as have been placed into
the right listbox.
Can anyone help me with this? I've tried having the left listbox update a
table, which the right listbox is based on, and requerying every time a
value is chosen, but this isn't working. Plus it seems like an extra step
to make a table and dynamically update it just to populate a different
listbox. I also started trying to make an array of variables in VBA, but
neither my attempts to add to the array nor my attempts to use that array as
a query criteria in my design grid was working.
Any help with this would be very much apreciated. And, if you think I'm
approaching the whole concept the wrong way, I'm open to better ways of
allowing users to choose several items from a table and use those choices as
the criteria in a query (same field, just every chosen value is added to the
"Or" statement of that field's criteria in the query; so if the user has
doubleclicked "String1" and "String2" and "String3," the query would have in
the criteria line of the field being queried "String1" Or "String2" Or
"String3"
Thanks for reading, and for any help.