From: JJ on
I used John's way:

SELECT Step5qry.[Customer Name], Step5qry.[Customer Group], Step5qry.[Sales
Empl ID]
FROM Step5qry
WHERE Step5qry.[Customer Group]=[Forms]![MiscVistaNP_frm]![Customer
Group] OR [Forms]![MiscVistaNP_frm]![Customer Group] = "*All"


"James A. Fortune" wrote:

> On Mar 23, 7:25 pm, KARL DEWEY <KARLDE...(a)discussions.microsoft.com>
> wrote:
> > You can not use 'Like' function inside of an IIF statement.
>
> What example led you to that conclusion?
>
> I tried:
>
> tblLike
> LID AutoNumber
> A Integer
> B Text
>
> LID A B
> 1 0 ABC
> 2 0 DEF
> 3 1 BCD
> 4 1 ABC
> 5 0 GHI
>
> qryLike:
> SELECT A, B
> FROM tblLike WHERE IIf(A = 1, (B LIKE '*A*'), True);
>
> !qryLike:
> A B
> 0 ABC
> 0 DEF
> 1 ABC
> 0 GHI
>
> Because of the precedence rules (e.g., LIKE is lower in the precedence
> hierarchy than OR), I usually enclose LIKE statements in parentheses,
> especially when used in conjunction with OR's and AND's, to guarantee
> the prevention of undesirable side effects.
>
> James A. Fortune
> MPAPoster(a)FortuneJames.com
> .
>
From: James A. Fortune on
On Mar 25, 12:42 pm, JJ <J...(a)discussions.microsoft.com> wrote:
> I used John's way:
>
> SELECT Step5qry.[Customer Name], Step5qry.[Customer Group], Step5qry.[Sales
> Empl ID]
> FROM Step5qry
> WHERE Step5qry.[Customer Group]=[Forms]![MiscVistaNP_frm]![Customer
> Group] OR [Forms]![MiscVistaNP_frm]![Customer Group] = "*All"

I'm glad you found a solution. That's the important thing. John's
query works because the = operator does not interpret any symbols as
wild cards. I was not trying to suggest a particular solution. I was
simply pointing out an apparent overgeneralization about the LIKE
operator.

James A. Fortune
MPAPoster(a)FortuneJames.com