Expresion to find a sentence in a field containing multiple sente

G

Guest

I have a querry in Access and I need an expresion that needs to find a group
of words in another field and return yes if it finds it and return blank if
it doen't find it. I have the following expression in which:

ADDED WORKLIFE REWARDS MEMBER: is the field name in the querry
Call_Comments is the field where it needs to search
ADDED WORKLIFE REWARDS MEMBER is the sentence that needs to search
"YES" is the outcome if it finds the sentence
" " is the outcome if it doen't find the sentence

This is the expresion that I have but since the Call_Comments field contains
more sentences all return to blank:

ADDED WORKLIFE REWARDS MEMBER: IIf([Call_Comments]="ADDED WORKLIFE REWARDS
MEMBER","YES"," ")
 
J

John Spencer

Try using Instr or Like in the IIF. My preference is to use LIKE in a
query.

ADDED WORKLIFE REWARDS MEMBER:
IIf([Call_Comments] Like "*ADDED WORKLIFE REWARDS MEMBER*","YES"," ")

OR
ADDED WORKLIFE REWARDS MEMBER:

IIf(Instr(1,[Call_Comments],"ADDED WORKLIFE REWARDS MEMBER",3)> 0,"YES","
")
 
G

Guest

ADDED WORKLIFE REWARDS MEMBER: IIf(Instr([Call_Comments], "ADDED WORKLIFE
REWARDS
MEMBER") <> 0,"YES"," ")
 
G

Guest

It worked. Thank you so much

Klatuu said:
ADDED WORKLIFE REWARDS MEMBER: IIf(Instr([Call_Comments], "ADDED WORKLIFE
REWARDS
MEMBER") <> 0,"YES"," ")

Alexandra504 said:
I have a querry in Access and I need an expresion that needs to find a group
of words in another field and return yes if it finds it and return blank if
it doen't find it. I have the following expression in which:

ADDED WORKLIFE REWARDS MEMBER: is the field name in the querry
Call_Comments is the field where it needs to search
ADDED WORKLIFE REWARDS MEMBER is the sentence that needs to search
"YES" is the outcome if it finds the sentence
" " is the outcome if it doen't find the sentence

This is the expresion that I have but since the Call_Comments field contains
more sentences all return to blank:

ADDED WORKLIFE REWARDS MEMBER: IIf([Call_Comments]="ADDED WORKLIFE REWARDS
MEMBER","YES"," ")
 
G

Guest

Thanks ... both expresions worked

John Spencer said:
Try using Instr or Like in the IIF. My preference is to use LIKE in a
query.

ADDED WORKLIFE REWARDS MEMBER:
IIf([Call_Comments] Like "*ADDED WORKLIFE REWARDS MEMBER*","YES"," ")

OR
ADDED WORKLIFE REWARDS MEMBER:

IIf(Instr(1,[Call_Comments],"ADDED WORKLIFE REWARDS MEMBER",3)> 0,"YES","
")


Alexandra504 said:
I have a querry in Access and I need an expresion that needs to find a
group
of words in another field and return yes if it finds it and return blank
if
it doen't find it. I have the following expression in which:

ADDED WORKLIFE REWARDS MEMBER: is the field name in the querry
Call_Comments is the field where it needs to search
ADDED WORKLIFE REWARDS MEMBER is the sentence that needs to search
"YES" is the outcome if it finds the sentence
" " is the outcome if it doen't find the sentence

This is the expresion that I have but since the Call_Comments field
contains
more sentences all return to blank:

ADDED WORKLIFE REWARDS MEMBER: IIf([Call_Comments]="ADDED WORKLIFE REWARDS
MEMBER","YES"," ")
 

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

Similar Threads

Expression Count 4
Problem constructing an SQL sentence by code 3
Blank and Numeric field Expresion 1
Expresion help! 5
Expresion 2
Find a word in a sentence 10
If Expressions 2
If expression 1

Top