Function in WHERE clause

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

It is possible to use a Function call in a WHERE expression like this:
WHERE FieldX=FunctionX(),
where FunctionX() is a Global Function in a Module.
But this expression does not work:
WHERE FieldX In (FunctionX()),
i.e. FunctionX is not called when the query is executed.
Any idea for another solution?
 
Hi,


It is possible to use a function in the WHERE clause.

It is possible to use a function in a IN list:

IN( fct1( ), fct2( ), fct3( ) )

ie, each function returns a scalar (a single data type value, or a single
string), not an array, not an object..


You can try

WHERE IsIn( fieldx, FctReturningAnArray() )


where IsIn is itself a user defined function that would return True, or
False, if the string, held in fieldX, is in on of the element returned by
your second user defined function FctReturningAnArray.




Hoping it may help,
Vanderghast, Access MVP
 
Back
Top