Query Trouble

E

Eoin McGlynn

Hellow,

I'm using the filter below to filter a query. However when "All Grades" is
selected it will not display the "is not null" filtered query. It is balnk.
If I change is not null to one of the grades in use, the filter is applied.

=IIf([forms]![frmGroupEmail]![emailfilter]="All Grades", Is Not
Null,[forms]![frmGroupEmail]![emailfilter])

Access 2007, Vista
Thanks,
Eoin
 
G

ghetto_banjo

You actually want to do away with the iif statement altogether and
replace it with a simpler Boolean operation.

This is what you want for criteria i think, give it a try:


[Forms]![frmGroupEmail].[emailfilter] OR [Forms]![frmGroupEmail].
[emailfilter] = "All Grades"



It seems like an odd way of doing it, but when you actually look at
what this translates to in SQL, you will see how the Boolean OR
statement works to return all results when your filter = "All Grades".
 
J

John W. Vinson

Hellow,

I'm using the filter below to filter a query. However when "All Grades" is
selected it will not display the "is not null" filtered query. It is balnk.
If I change is not null to one of the grades in use, the filter is applied.

=IIf([forms]![frmGroupEmail]![emailfilter]="All Grades", Is Not
Null,[forms]![frmGroupEmail]![emailfilter])

Access 2007, Vista
Thanks,
Eoin

You cannot use query operators such as IS NOT NULL, >, <, IN() etc. in IIF
statements - only the actual value.

Rather than using IIF at all, try a criterion such as

= [forms]![frmGroupEmail]![emailfilter] OR
([forms]![frmGroupEmail]![emailfilter] = "All Grades" AND [Email] IS NOT NULL)
 
K

KARL DEWEY

Is Not Null happens to be a function and you can not return such from an IIF
statement.
Try this --
Like IIf([forms]![frmGroupEmail]![emailfilter]="All Grades", "*",
[forms]![frmGroupEmail]![emailfilter])
 
E

Eoin McGlynn

Thanks, you're a genius!

KARL DEWEY said:
Is Not Null happens to be a function and you can not return such from an IIF
statement.
Try this --
Like IIf([forms]![frmGroupEmail]![emailfilter]="All Grades", "*",
[forms]![frmGroupEmail]![emailfilter])

--
Build a little, test a little.


Eoin McGlynn said:
Hellow,

I'm using the filter below to filter a query. However when "All Grades" is
selected it will not display the "is not null" filtered query. It is balnk.
If I change is not null to one of the grades in use, the filter is applied.

=IIf([forms]![frmGroupEmail]![emailfilter]="All Grades", Is Not
Null,[forms]![frmGroupEmail]![emailfilter])

Access 2007, Vista
Thanks,
Eoin
 

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