A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Passing Multi-Select to a Query



 
 
Thread Tools Display Modes
  #1  
Old December 2nd, 2009, 06:10 PM posted to microsoft.public.access.queries
LarryP
external usenet poster
 
Posts: 73
Default 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  
Old December 2nd, 2009, 06:51 PM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default 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  
Old December 2nd, 2009, 06:51 PM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default 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  
Old December 2nd, 2009, 06:51 PM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default 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  
Old December 3rd, 2009, 03:06 PM posted to microsoft.public.access.queries
LarryP
external usenet poster
 
Posts: 73
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:42 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.