Query Criteria Return both "*" and null fields (1 Viewer)

joeKra

Registered User.
Local time
Yesterday, 19:18
Joined
Jan 24, 2012
Messages
208
Hi,
i need help for this criteria, in the false part it should return anything even its null, i tried adding "*" or is null does not work,
any help??

thanks in advance:


Code:
Like IIf([Forms]![Master].[Customers_Panel].[Form]![cmbSearchBY]=3,'*' & [Forms]![Master].[Customers_Panel].[Form]![txtSearch] & '*',[COLOR="Red"]'*'[/COLOR])
 

rzw0wr

I will always be a newbie
Local time
Yesterday, 19:18
Joined
Apr 1, 2012
Messages
489
OK, will you tell us how it does not work?
What is it not doing that you would like it to do.

Also the quote are not needed I don't think.


Dale
 

joeKra

Registered User.
Local time
Yesterday, 19:18
Joined
Jan 24, 2012
Messages
208
i want in the false part of the iiF it should return everything even null values, because its filtering on another field, and if i am adding the "*" in the false part , it will only return fields having some value
 

rzw0wr

I will always be a newbie
Local time
Yesterday, 19:18
Joined
Apr 1, 2012
Messages
489
is there any other criteria in the query?
Can you copy and paste the SQL from this query.

Dale
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:18
Joined
Feb 19, 2002
Messages
43,645
The following should get you closer to the correct syntax (ditch the IIf()) but I don't have enough information from what you posted to create the exact clause you need. Notice the parentheses that surround the first condition. They are required whenever your condition includes AND, OR, and NOT operands to specify the order of evaluation.

WHERE ([Forms]![Master].[Customers_Panel].[Form]![cmbSearchBY] = 3 AND SomeField Like "*" & [Forms]![Master].[Customers_Panel].[Form]![txtSearch] & '*') OR SomeField Is Null
 

rzw0wr

I will always be a newbie
Local time
Yesterday, 19:18
Joined
Apr 1, 2012
Messages
489
Thanks for the help Pat.

Queries are not my long suit.

Dale
 

Users who are viewing this thread

Top Bottom