M
maki
I have a table (tblStores) with store names and inventory
Store Item
A hat
A glove
B glove
D hat
D shirt
I have a table (tblItems) with information on each item in inventory
Item Price
hat 1.00
glove 3.00
shirt 2.50
pen 1.25
I have a form (Form1) with a listbox showing the items in inventory.
For example:
"hat"
"glove"
"shirt"
"pen"
When items are selected from the listbox (multi-select = extended)
they are shown in an unbound text box called txtItems. If the user
selects "hat" and "shirt", the text box (txtItems) ends up showing
'hat','shirt'.
I want to query the tblStores to see which stores have which items on
that list. I tried this:
SELECT tblStores.store, tblStores.item
FROM tblStores
WHERE (((tblStores.item) In ([forms]![Form1]![txtItems])));
It comes up blank
When I change the query to the following it works:
SELECT tblStores.store, tblStores.item
FROM tblStores
WHERE (((tblStores.item) In ('hat','shirt')));
I get a table that shows the following:
store item
A hat
D hat
D shirt
Any idea why the IN( ) function won't work with the field reference
instead of actual data? Any help would be appreciated. Thanks.
Store Item
A hat
A glove
B glove
D hat
D shirt
I have a table (tblItems) with information on each item in inventory
Item Price
hat 1.00
glove 3.00
shirt 2.50
pen 1.25
I have a form (Form1) with a listbox showing the items in inventory.
For example:
"hat"
"glove"
"shirt"
"pen"
When items are selected from the listbox (multi-select = extended)
they are shown in an unbound text box called txtItems. If the user
selects "hat" and "shirt", the text box (txtItems) ends up showing
'hat','shirt'.
I want to query the tblStores to see which stores have which items on
that list. I tried this:
SELECT tblStores.store, tblStores.item
FROM tblStores
WHERE (((tblStores.item) In ([forms]![Form1]![txtItems])));
It comes up blank
When I change the query to the following it works:
SELECT tblStores.store, tblStores.item
FROM tblStores
WHERE (((tblStores.item) In ('hat','shirt')));
I get a table that shows the following:
store item
A hat
D hat
D shirt
Any idea why the IN( ) function won't work with the field reference
instead of actual data? Any help would be appreciated. Thanks.