Criteria is passed by Function call

ions

Access User
Local time
Today, 11:30
Joined
May 23, 2004
Messages
824
Dear Access Query Expert

I have created a query which has a function call as the criteria for one of the numerical fields. The function returns a string expression such as .....

1) 132 OR 142 OR 156
2) 132 OR 142
3) 132

..... into the criteria section of the numerical field.

Unfortunately, the query doesn't work if the criteria is generated by the function call. However, if I hardcode the criteria (don't send a function call but directly write 132 OR 142 OR 156) the query works.

I am puzzled and I am not sure how to solve this problem.

Thank you so much.
 
You can make your function return the numbers in a string delimited by commas such as

1) ,132,142,156,
2) ,132,142,
3) ,132,

and use the InStr() function in the Where Clause of the query like this:-

SELECT ...........
FROM ...........
WHERE InStr(yourFunction(), "," & [yourFieldName] & ",");
.
 

Users who are viewing this thread

Back
Top Bottom