Global Query Criteria via Function

S

Suthee

Hi all,

I have a table in my application that allows a user to define "custom
criteria" to be used in many query objects. This table is accessed via a
form. I've created several functions that perform a DLookup on the values
that the user entered into the specific field in the table. The user is
entering these into a format that would be allowed in the QBE panel.

For example: Not In("300","500","100")
Another example: Not Like "QB*" And Not Like "TC*"

In the queries, in the criteria, I am calling the function. For example, I
might call the function ClientIdFilter() from the criteria box on the QBE
panel of the query. This would call the text string like the examples I
entered above. Unfortunately this is not working. I think access might be
putting " " around the returned function value so the criteria is being used
incorrectly. If the user types, for example, just "300" (without quotes) as
the string in the field of the table for the criteria, the function works
fine as only showing Client ID 300.

Long story short I'm trying to allow a user to define these filters to be
used in the query objects. I need to be able to call these values from VBA
or from a query object. These filters will almost always contain multiple
Client IDs, etc.. Is there a way to do this on my current thought process,
or is there a better way to do this?

TIA for any suggestions.
 
Top