Use the IN operator
The SQL statement will end up something like this:
WHERE MyTextField IN ("X", "Y", "Z")
Here's an example that loops through the ItemsSelected in a multi-select
list box and builds up that kind of string:
Use a multi-select list box to filter a report
at:
http://allenbrowne.com/ser-50.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Terry C." <cl*******@yahoo.com> wrote in message
news:lV******************@southeast.rr.com...
I have a bit of code that loops through a listbox and creates a string of
multiple selections and then passes that string to a SQL statement.
However, I cannot seem to get a handle on the proper syntax for the WHERE
clause to properly pass the string in the format of 'X' OR 'Y' to the
query's criteria field. Can someone clarify this syntax or point me to a
good example of using a varible string in the WHERE clause of a SQL
statement?
Thanks in advance