IIf() Statement in Query Criteria

  • Thread starter Thread starter Isbjornen
  • Start date Start date
I

Isbjornen

Hello,

First I want to thank Tom Ellison and John Vinson for
helping me out yesterday. Now that's done, here's my
question, similar to my question yesterday:

In the Criteria for my query I have the following
statement:

Like IIf([Forms]![frmStampsMain]![fraActive]=3,"Bonded",IIf
([Forms]![frmStampsMain]![fraActive]=4,"Unassigned","*"))

If [fraActive] is 3 or 4, it shows "Bonded"
or "Unassigned", otherwise it shows everything.

Now, if [fraActive] is not 3 or 4, I want the query to
show everything, but not "Bonded" and "Unassigned".

Something like this:
Like IIf([Forms]![frmStampsMain]![fraActive]=3,"Bonded",IIf
([Forms]![frmStampsMain]![fraActive]=4,"Unassigned",' Show
all "*" but not "Bonded" or "Unassigned" '))

Is it possible?

Isbjornen
 
Try this:

Like IIf([Forms]![frmStampsMain]![fraActive]=3,"Bonded","") Or Like
IIf([Forms]![frmStampsMain]![fraActive]=4,"Unassigned","") Or ((Not Like
IIf([Forms]![frmStampsMain]![fraActive]<>3 And
[Forms]![frmStampsMain]![fraActive]<>4,"Bonded",Null) and (Not Like
IIf([Forms]![frmStampsMain]![fraActive]<>3 And
[Forms]![frmStampsMain]![fraActive]<>4,"Unassigned",Null))
 
Or...

IIf([Forms]![frmStampsMain]![fraActive]=3,"Bonded",IIf([Forms]![frmStampsMain]![fraActive]=4,"Unassigned",Not
In("Bonded","Unassigned")))

- Steve Schapel, Microsoft Access MVP
 
Ack! That is what I was trying to remember in my brain! Much simpler! :-)

--
Ken Snell
<MS ACCESS MVP>

Steve Schapel said:
Or...

IIf([Forms]![frmStampsMain]![fraActive]=3,"Bonded",IIf([Forms]![frmStampsMai
n]![fraActive]=4,"Unassigned",Not
In("Bonded","Unassigned")))

- Steve Schapel, Microsoft Access MVP


Try this:

Like IIf([Forms]![frmStampsMain]![fraActive]=3,"Bonded","") Or Like
IIf([Forms]![frmStampsMain]![fraActive]=4,"Unassigned","") Or ((Not Like
IIf([Forms]![frmStampsMain]![fraActive]<>3 And
[Forms]![frmStampsMain]![fraActive]<>4,"Bonded",Null) and (Not Like
IIf([Forms]![frmStampsMain]![fraActive]<>3 And
[Forms]![frmStampsMain]![fraActive]<>4,"Unassigned",Null))
 
Thank You Ken and Steve

Isbjornen

-----Original Message-----
Ack! That is what I was trying to remember in my brain! Much simpler! :-)

--
Ken Snell
<MS ACCESS MVP>

Steve Schapel said:
Or...

IIf([Forms]![frmStampsMain]![fraActive]=3,"Bonded",IIf ([Forms]![frmStampsMai
n]![fraActive]=4,"Unassigned",Not
In("Bonded","Unassigned")))

- Steve Schapel, Microsoft Access MVP


Try this:

Like IIf([Forms]![frmStampsMain]![fraActive] =3,"Bonded","") Or Like
IIf([Forms]![frmStampsMain]![fraActive] =4,"Unassigned","") Or ((Not Like
IIf([Forms]![frmStampsMain]![fraActive]<>3 And
[Forms]![frmStampsMain]![fraActive]<>4,"Bonded",Null) and (Not Like
IIf([Forms]![frmStampsMain]![fraActive]<>3 And
[Forms]![frmStampsMain]![fraActive]

.
 
Back
Top