Query Parameter

  • Thread starter Thread starter Harmony
  • Start date Start date
H

Harmony

I am working on a query that pulls its criteria from an
unbound field on a form. I would like it to recognize more
than one entry. For example, if the unbound text box
contains '1 OR 2', I want it to show all records with 1 OR
2 in that field. This doesn't work. I enter that exact
thing into the query criteria directly or if I only entry
one item into the unbound text box, it works.

Any ideas?

Thanks!

Harmony
 
In a query, to find a field with a 1 or a 2, you would put:

WHERE field = 1 or field = 2

What you think is working, isn't.

You can present the user a MultiSelect List box, step through it's
itemsselected collection, and create an IN Clause.

WHERE field IN ("1","2")

--
HTH,

Steve Clark, Access MVP
FMS, Inc.
Professional Solutions Group
http://www.FMSInc.com
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Is your Access database too slow?
Are you ready to upgrade to SQL Server?
Contact us for optimization and/or upsizing!
http://www.FMSInc.com/consulting
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
 
Thanks Steve,

I do have a multiselect List box and then using an event
procedure the items seleced populate an unbound textbox. I
am then pointing that textbox to my query by using forms!
form1!textbox in the criteria of the field I am trying to
filter. I tried to change this to an IN clause as you
suggested and am still getting no returned records. It
seems not to recognize more than one field entry in the
textbox no matter what I do. Do you have any other
suggestions on how I could get the fields selected from my
list box into my where clause in the Access query?

Thanks for your help,

Harmony
 
Back
Top