If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Passing Multi-Select to a Query
I sometimes need to pass the results from a multi-select list box to a query,
e.g., "Apple" or "Orange" or "Grape" etc. I've done this before by writing a bunch of code to build a concatenated string from an array of selected values, but it gets kind of tedious. Anybody know of a slick way to tell a query "use all the values in this array as criteria, and accept anything that matches"? Or better yet, "Use everything that has been selected in control x", skipping over the whole array part? I could probably write a function to do that, but I'm hoping some whiz out there has already done so and I can shamelessly plagiarize. It would be really nifty to just put =StuffInControlX() as a query criterion! |
#2
|
|||
|
|||
Passing Multi-Select to a Query
There is a solution at http://www.tek-tips.com/faqs.cfm?fid=6099. It might be
a bit slow with large tables. -- Duane Hookom Microsoft Access MVP "LarryP" wrote: I sometimes need to pass the results from a multi-select list box to a query, e.g., "Apple" or "Orange" or "Grape" etc. I've done this before by writing a bunch of code to build a concatenated string from an array of selected values, but it gets kind of tedious. Anybody know of a slick way to tell a query "use all the values in this array as criteria, and accept anything that matches"? Or better yet, "Use everything that has been selected in control x", skipping over the whole array part? I could probably write a function to do that, but I'm hoping some whiz out there has already done so and I can shamelessly plagiarize. It would be really nifty to just put =StuffInControlX() as a query criterion! |
#3
|
|||
|
|||
Passing Multi-Select to a Query
There is a solution at http://www.tek-tips.com/faqs.cfm?fid=6099. It might be
a bit slow with large tables. -- Duane Hookom Microsoft Access MVP "LarryP" wrote: I sometimes need to pass the results from a multi-select list box to a query, e.g., "Apple" or "Orange" or "Grape" etc. I've done this before by writing a bunch of code to build a concatenated string from an array of selected values, but it gets kind of tedious. Anybody know of a slick way to tell a query "use all the values in this array as criteria, and accept anything that matches"? Or better yet, "Use everything that has been selected in control x", skipping over the whole array part? I could probably write a function to do that, but I'm hoping some whiz out there has already done so and I can shamelessly plagiarize. It would be really nifty to just put =StuffInControlX() as a query criterion! |
#4
|
|||
|
|||
Passing Multi-Select to a Query
There is a solution at http://www.tek-tips.com/faqs.cfm?fid=6099. It might be
a bit slow with large tables. -- Duane Hookom Microsoft Access MVP "LarryP" wrote: I sometimes need to pass the results from a multi-select list box to a query, e.g., "Apple" or "Orange" or "Grape" etc. I've done this before by writing a bunch of code to build a concatenated string from an array of selected values, but it gets kind of tedious. Anybody know of a slick way to tell a query "use all the values in this array as criteria, and accept anything that matches"? Or better yet, "Use everything that has been selected in control x", skipping over the whole array part? I could probably write a function to do that, but I'm hoping some whiz out there has already done so and I can shamelessly plagiarize. It would be really nifty to just put =StuffInControlX() as a query criterion! |
#5
|
|||
|
|||
Passing Multi-Select to a Query
That looks very promising, thank you Duane.
"Duane Hookom" wrote: There is a solution at http://www.tek-tips.com/faqs.cfm?fid=6099. It might be a bit slow with large tables. -- Duane Hookom Microsoft Access MVP "LarryP" wrote: I sometimes need to pass the results from a multi-select list box to a query, e.g., "Apple" or "Orange" or "Grape" etc. I've done this before by writing a bunch of code to build a concatenated string from an array of selected values, but it gets kind of tedious. Anybody know of a slick way to tell a query "use all the values in this array as criteria, and accept anything that matches"? Or better yet, "Use everything that has been selected in control x", skipping over the whole array part? I could probably write a function to do that, but I'm hoping some whiz out there has already done so and I can shamelessly plagiarize. It would be really nifty to just put =StuffInControlX() as a query criterion! |
Thread Tools | |
Display Modes | |
|
|