Can I Use a function in a queries criteria.

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

Guest

Hi,

I was wondering if It is possible to use a function in the criteria field of
a query in Access? Specifically can I say " In Getlist() " , thus getting
all records from a table where their value is in the returned value of the
Getlist() function.

Any help of this would be awesome.
 
Dear James:

I take it you have a custom function Getlist(). Make sure it is Public.
Just write the function into the query, with any required parameters.

Tom Ellison
 
First, you function needs to be in a standard module. It needs to return a
value the query can understand. For your purposes, I would suggest
True/False.

Then you need to pass fields or some value calculated from fields to the
function for it to evaluate so it can determine whether to included the row
in the result.

Create a field that calls the query:

AddToList: GetList([SomeField])

Then, in the criteria row for this field just enter True

Your query will then include rows where GetList() returns True and exclude
those that return False.
 
Back
Top