How to Find Data in Part of Cell

D

doyle60

I have a query with a field called Fabric. I want to create a column
in the query that returns Yes if any part of the Fabric field has the
letters "cot" in it.

So I naturally thought to put asterics around the word ("*Cot*") and
writing this:

Cot: IIf(Fabric = "*Cot*","Yes")

But it doesn't work and returns nothing for all.

How do I do this correctly?

Thanks,

Matt
 
F

fredg

I have a query with a field called Fabric. I want to create a column
in the query that returns Yes if any part of the Fabric field has the
letters "cot" in it.

So I naturally thought to put asterics around the word ("*Cot*") and
writing this:

Cot: IIf(Fabric = "*Cot*","Yes")

But it doesn't work and returns nothing for all.

How do I do this correctly?

Thanks,

Matt

Cot:IIf(Instr([FieldName],"Cot")>0,"Yes","No")
 
D

doyle60

Thanks Bob. But it didn't work. After five minutes of playing around
with it, I was able to figure out that "Like" was needed and not "Is
Like". So this works:

Cot: IIf([Fabric] Like "*" & "cot" & "*","Yes","")

Thanks,

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top