Use Multi-Select List Box as Query Parameter

  • Follow


Is there a way to get the multiple selections from a list box into my query 
as the parameters?
0
Reply Utf 3/10/2008 7:27:01 PM

You need to use VBA. http://www.mvps.org/access/forms/frm0007.htm at "The 
Access Web" is an example, although personally I prefer using code more 
similar to http://www.mvps.org/access/reports/rpt0005.htm since it generates 
shorter criteria. (The first one generates a criteria like Field1 = Value1 
Or Field1 = Value3 or Field1 = Value4, while the second one generates a 
criteria like Field1 In (Value1, Value2, Value3))

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"djf" <djf@discussions.microsoft.com> wrote in message 
news:8B7718BB-2AC2-4278-B611-2ED82E93FD87@microsoft.com...
> Is there a way to get the multiple selections from a list box into my 
> query
> as the parameters? 


0
Reply Douglas 3/10/2008 7:35:03 PM


I found this code on an Internet search. I'm using method 2. I also found the 
code that you've listed on the same search. Method 2 is working, with a few 
things I'm trying to work out. My query has two criteria fields, one 
generated from a combo box and one generated from a list box. I'm not sure if 
I can use method 2 for this type of query. The code does work, however when I 
modify for my db.

What is the difference between method 2 and the code that you suggest?

http://support.microsoft.com/kb/q135546

"Douglas J. Steele" wrote:

> You need to use VBA. http://www.mvps.org/access/forms/frm0007.htm at "The 
> Access Web" is an example, although personally I prefer using code more 
> similar to http://www.mvps.org/access/reports/rpt0005.htm since it generates 
> shorter criteria. (The first one generates a criteria like Field1 = Value1 
> Or Field1 = Value3 or Field1 = Value4, while the second one generates a 
> criteria like Field1 In (Value1, Value2, Value3))
> 
> -- 
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
> 
> 
> "djf" <djf@discussions.microsoft.com> wrote in message 
> news:8B7718BB-2AC2-4278-B611-2ED82E93FD87@microsoft.com...
> > Is there a way to get the multiple selections from a list box into my 
> > query
> > as the parameters? 
> 
> 
> 
0
Reply Utf 3/11/2008 6:58:04 PM

At a quick glance, I don't see any real difference between the two.

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"djf" <djf@discussions.microsoft.com> wrote in message 
news:E7ABFF4D-233E-4AEC-9D20-EB6318D2DFEF@microsoft.com...
>I found this code on an Internet search. I'm using method 2. I also found 
>the
> code that you've listed on the same search. Method 2 is working, with a 
> few
> things I'm trying to work out. My query has two criteria fields, one
> generated from a combo box and one generated from a list box. I'm not sure 
> if
> I can use method 2 for this type of query. The code does work, however 
> when I
> modify for my db.
>
> What is the difference between method 2 and the code that you suggest?
>
> http://support.microsoft.com/kb/q135546
>
> "Douglas J. Steele" wrote:
>
>> You need to use VBA. http://www.mvps.org/access/forms/frm0007.htm at "The
>> Access Web" is an example, although personally I prefer using code more
>> similar to http://www.mvps.org/access/reports/rpt0005.htm since it 
>> generates
>> shorter criteria. (The first one generates a criteria like Field1 = 
>> Value1
>> Or Field1 = Value3 or Field1 = Value4, while the second one generates a
>> criteria like Field1 In (Value1, Value2, Value3))
>>
>> -- 
>> Doug Steele, Microsoft Access MVP
>> http://I.Am/DougSteele
>> (no e-mails, please!)
>>
>>
>> "djf" <djf@discussions.microsoft.com> wrote in message
>> news:8B7718BB-2AC2-4278-B611-2ED82E93FD87@microsoft.com...
>> > Is there a way to get the multiple selections from a list box into my
>> > query
>> > as the parameters?
>>
>>
>> 


0
Reply Douglas 3/11/2008 7:11:50 PM

Thanks for your help, I appreciate it.

"Douglas J. Steele" wrote:

> At a quick glance, I don't see any real difference between the two.
> 
> -- 
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
> 
> 
> "djf" <djf@discussions.microsoft.com> wrote in message 
> news:E7ABFF4D-233E-4AEC-9D20-EB6318D2DFEF@microsoft.com...
> >I found this code on an Internet search. I'm using method 2. I also found 
> >the
> > code that you've listed on the same search. Method 2 is working, with a 
> > few
> > things I'm trying to work out. My query has two criteria fields, one
> > generated from a combo box and one generated from a list box. I'm not sure 
> > if
> > I can use method 2 for this type of query. The code does work, however 
> > when I
> > modify for my db.
> >
> > What is the difference between method 2 and the code that you suggest?
> >
> > http://support.microsoft.com/kb/q135546
> >
> > "Douglas J. Steele" wrote:
> >
> >> You need to use VBA. http://www.mvps.org/access/forms/frm0007.htm at "The
> >> Access Web" is an example, although personally I prefer using code more
> >> similar to http://www.mvps.org/access/reports/rpt0005.htm since it 
> >> generates
> >> shorter criteria. (The first one generates a criteria like Field1 = 
> >> Value1
> >> Or Field1 = Value3 or Field1 = Value4, while the second one generates a
> >> criteria like Field1 In (Value1, Value2, Value3))
> >>
> >> -- 
> >> Doug Steele, Microsoft Access MVP
> >> http://I.Am/DougSteele
> >> (no e-mails, please!)
> >>
> >>
> >> "djf" <djf@discussions.microsoft.com> wrote in message
> >> news:8B7718BB-2AC2-4278-B611-2ED82E93FD87@microsoft.com...
> >> > Is there a way to get the multiple selections from a list box into my
> >> > query
> >> > as the parameters?
> >>
> >>
> >> 
> 
> 
> 
0
Reply Utf 3/11/2008 7:35:04 PM

4 Replies
807 Views

(page loaded in 0.136 seconds)

Similiar Articles:
















7/23/2012 8:08:16 PM


Reply: