Re: Using a OR() like function in an IIF statement



Thanks Rick, the IN clause is exactly what I was looking for!

Rick Brandt wrote:
Hello, I am trying to create an IIF statement to test if the first
character in a field is a 1,2,8 or 9.
[quoted text clipped - 6 lines]
statement? Thanks,
Kerry

Two ways come to mind. The long way is to use OR as you are, but you have
to repeat the field name each time...

IIf(Left([possible_SO_match],1)="1" or Left([possible_SO_match],1)="2" or
Left([possible_SO_match],1)="8" or
Left([possible_SO_match],1)="9",[Possible_SO_Match],"No Match")

The shorter version is to use an IN() clause.

IIf(Left([possible_SO_match],1) IN("1", "2", "8",
"9"),[Possible_SO_Match],"No Match")


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200704/1

.



Relevant Pages

  • Re: Comparisons
    ... The WHERE clause it just ... to filter out rows where this has already been done before. ... UPDATE Products ... Rick Brandt, Microsoft Access MVP ...
    (comp.databases.ms-access)
  • Re: where clause help
    ... Rick Brandt wrote: ... i cant figure out how i would write in a 2nd where clause. ... Prev by Date: ...
    (microsoft.public.access.gettingstarted)
  • Re: Match problem
    ... outlet type text contains values like 1,2,3,4 ... ...But it would generally be faster to add the table to your query and join ... clause is the only way to accomplish something. ... Rick Brandt, Microsoft Access MVP ...
    (microsoft.public.access.forms)
  • Re: Too many records!!!
    ... In clause with sub-query should do it. ... That In clause should even work as a filter. ... Rick Brandt, Microsoft Access MVP ...
    (microsoft.public.access.forms)
  • Re: Calculated query field will not filter
    ... I am not sure what you mean by repeat the expression in the where clause. ... I understand what you are saying about the text field producing error. ... perform a *text* comparison (i.e. character by character.) ... I have a query of addresses where I would like to filter on even door ...
    (microsoft.public.access.queries)