Help needed using the * operator as criteria...

PaulSpell

Registered User.
Local time
Today, 23:40
Joined
Apr 19, 2002
Messages
201
Hello,

I have a query that uses a function to return the criteria for filtering records.

This seems to work ok except when I want all records included. I want the function to return a string that uses the "*" operator so that all records are shown......but I can't get it to work. I've tried passing back: "Like ""*""" and "Like " & Chr$(34) & "*" & Chr$(34) & "" , but neither work.

Does anyone have a solution?
 
Iif you are putting it in a string you need single quotes '*' so you would return '*' or funxtionname = "'*'"
That's doubleQ Singleq * Singleq DoubleQ
 
Tried this before and it didn't work. I get a data type mismatch.

The return type of the function is Variant and the query field being filtered is an integer???
 
You can only use * on a string type field. An integer field can have a wildcard for a single digit (#) or you have to use something like >0 or <1
 
Nope, still not working.

What I need to do is dynamically change the query criteria. I think I will use the CreateQueryDef method instead, but thanks for your help anyway.
 

Users who are viewing this thread

Back
Top Bottom