IIF condition in a query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In a query - I would like to have the ContainerID field return "Other" if
"Container" is not in the field somewhere and for all else the value of
ContainerID. The following line brings up no data when I know there is:

IIf(([Inventory].[ContainerID]) Not Like
("Container"),"Other",[Inventory].[ContainerID])

Can you suggest what I am doing wrong?

Thanks in advance.
 
Sorry guys - I figured it out. I needed to create a calculated field and I
was trying to return the value in the ContainerID field which saw it as
criteria.

Thanks anyway.
 
Hi Bonnie,

The syntax below will search for any word "Container" (upper or lower case)
in your field [Inventory].[ContainerID].

IIf(InStr([Inventory].[ContainerID],"Container"),[Inventory].[ContainerID],
"Other")

Hope this will help.
 
Back
Top