Using IIF in criteria of Query

V

vishalsheth01

Hey
I have a form with a check box and it previews a report through
query. I have a meme field that has "This is a speical material" an
other information in certain records that are considered "Specia
materials." In my report i would like to pull up a list of thes
special materials. right now, i have
IIF([Forms]![frmSearch]![chkSpecial] = true, "Like *special*", "") bu
nothing seems to be coming up. can anyone suggest what i'm doin
wrong? many thanks in advance
Visha
 
F

fredg

Hey,
I have a form with a check box and it previews a report through a
query. I have a meme field that has "This is a speical material" and
other information in certain records that are considered "Special
materials." In my report i would like to pull up a list of these
special materials. right now, i have:
IIF([Forms]![frmSearch]![chkSpecial] = true, "Like *special*", "") but
nothing seems to be coming up. can anyone suggest what i'm doing
wrong? many thanks in advance,
Vishal


In the query, as criteria on the Memo field, use:

Like IIf([Forms]![frmSearch]![chkSpecial] = -1, "*special*", "")

The form must be open when the report is run.
 
D

Duane Hookom

Please tell us what you mean by "still didn't work". Last I checked, no one
could see your computer screen or your sql view.
 
V

vishalsheth01

sorry..."still didn't work" means that nothing came up in my report. s
fa
IIF([Forms]![frmSearch]![chkSpecial] = true, "Like *special*", ""
IIF([Forms]![frmSearch]![chkSpecial] = -1, "Like *special*", ""
IIF([Forms]![frmSearch]![chkSpecial] = true; "Like *special*"; "") ar
the things i've tried in my criteria but none of them work, as in, non
of them bring up any records in my report. Does any body know why o
have any other suggestions
 
V

vishalsheth01

thank you for pointing that out...i didn't see the "like" part befor
his suggestion. it works fine now. thanks for everybody's hel
 
F

fredg

sorry..."still didn't work" means that nothing came up in my report. so
far
IIF([Forms]![frmSearch]![chkSpecial] = true, "Like *special*", "")
IIF([Forms]![frmSearch]![chkSpecial] = -1, "Like *special*", "")
IIF([Forms]![frmSearch]![chkSpecial] = true; "Like *special*"; "") are
the things i've tried in my criteria but none of them work, as in, none
of them bring up any records in my report. Does any body know why or
have any other suggestions?

Is there some reason you didn't copy my response "exactly"?

The Like keyword is placed first on the criteria line, then the IIf
statement follows it.

Like IIF([Forms]![frmSearch]![chkSpecial] = -1,"*special*","")

The above will return all records in which the word "special" is found
anywhere in the field.
 
V

vishalsheth01

i'm sorry...I didn't copy it, i typed it in myself. I guess i jus
missed the "like" at the beginning. I thought the change you made wa
in replacing "True" with "-1" my deepest apologies go out to you.
Next time I will just copy the information and avoid any confusion.
once again...i'm sorr
 
Top