KernelK
Registered User.
- Local time
- Today, 18:55
- Joined
- Oct 3, 2006
- Messages
- 173
Quick question that I know someone here can help me with. I am using a function in a query's criteria to filter the query data. It is a simple function that simply returns a global variable. The global variable is set by a form where the criteria is specified (a multi select list box with agent names). This form goes through the list box finding all selected entries and creates the criteria string that is then passed to the query through the function. Oh, and the table field data type is text. I have tried every variation of syntax for this criteria string, but cannot create one that will use multiple criteria. I have tried, strCriteria =
"= '" & name1 & "' OR '" & name2 & "' OR '" & name3 & "'"
"'" & name1 & "' OR '" & name2 & "' OR '" & name3 & "'"
name1 & " OR " & name2 & " OR " & name3
I have also tried to switch my double/single quotes around and using chr(34) for double quotes within the string.
The only time I can make the search criteria work is when I have a single selection and the format is without quotes ie strCriteria = name1
What is the proper way of writing the string to pass into the criteria field via my function? Is it possible to specify multiple criteria in this way?
"= '" & name1 & "' OR '" & name2 & "' OR '" & name3 & "'"
"'" & name1 & "' OR '" & name2 & "' OR '" & name3 & "'"
name1 & " OR " & name2 & " OR " & name3
I have also tried to switch my double/single quotes around and using chr(34) for double quotes within the string.
The only time I can make the search criteria work is when I have a single selection and the format is without quotes ie strCriteria = name1
What is the proper way of writing the string to pass into the criteria field via my function? Is it possible to specify multiple criteria in this way?