Show all records with a keyword ex:"ALL"

E

Eli the Iceman

Does anyone knows how to insert a parameter in MS Access Query that will show
all records is a combobox in a form has the field equal to some text, example
"ALL" and then if not show records equal to combobox value? I tried all kind
of way, but to no success. I can get it to work with null, but not with some
other value. Here is what I did already:
IIF([Forms]![formname]![combo1] like "ALL", is null,
[Forms]![formname]![combo1])

IIF([Forms]![formname]![combo1] like "ALL", "", [Forms]![formname]![combo1])

IIF([Forms]![formname]![combo1] like "ALL", "*", [Forms]![formname]![combo1])

and many more,

Thanks,
 
J

John Spencer

Criteria: [Forms]![formname]![combo1] OR [Forms]![formname]![combo1] =
"ALL"

In an SQL statement that would be

WHERE ([Some Field] = [Forms]![formname]![combo1] or
[Forms]![formname]![combo1] = "ALL")

IF [Some Field] ALWAYS has a value then you can use
WHERE [SomeField] Like IIF([Forms]![formname]![combo1] = "All","*",
[Forms]![formname]![combo1])
 
J

John Vinson

Does anyone knows how to insert a parameter in MS Access Query that will show
all records is a combobox in a form has the field equal to some text, example
"ALL" and then if not show records equal to combobox value? I tried all kind
of way, but to no success. I can get it to work with null, but not with some
other value. Here is what I did already:
IIF([Forms]![formname]![combo1] like "ALL", is null,
[Forms]![formname]![combo1])

IIF([Forms]![formname]![combo1] like "ALL", "", [Forms]![formname]![combo1])

IIF([Forms]![formname]![combo1] like "ALL", "*", [Forms]![formname]![combo1])

and many more,

Thanks,

Try a criterion

=[Forms]![formname]![combo1] OR [Forms]![formname]![combo1] = "ALL"

or (in my opinion less desirably)

LIKE IIF([Forms]![formname]![combo1] = "ALL", "*",
[Forms]![formname]![combo1])

John W. Vinson[MVP]
 
E

Eli the Iceman

I must of had a Brain Fart, thanks so much, it worked great. I kept doing
exactly the same thing, other than forgeting to put the like statement in
front.
 

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