IIF in a query

G

Guest

I cant seem to get this to work right. I am trying to use an IIF statement
in a query and it doesn't seem to work. I want the query to pull information
based on what the user chooses from a combo box.

IIf([Forms]![frmUserList]![Combo2]="all",is not
null,[forms]![frmuserlist]![combo2])

So if the user chooses anything other then "ALL", then I want the query to
pulled based on the name they choose but if they choose "all" then I want the
query to pull all non-blank data which should be everything. The second part
aseems to work but when i choose "All" i get nothing.

Any help would be appreciated.

Thanks
 
F

fredg

I cant seem to get this to work right. I am trying to use an IIF statement
in a query and it doesn't seem to work. I want the query to pull information
based on what the user chooses from a combo box.

IIf([Forms]![frmUserList]![Combo2]="all",is not
null,[forms]![frmuserlist]![combo2])

So if the user chooses anything other then "ALL", then I want the query to
pulled based on the name they choose but if they choose "all" then I want the
query to pull all non-blank data which should be everything. The second part
aseems to work but when i choose "All" i get nothing.

Any help would be appreciated.

Thanks

Like IIf([Forms]![frmUserList]![Combo2]="all", "*",
forms!!frmUserList!Combo2)
 
G

Guest

Thank you. it worked perfectly.

fredg said:
I cant seem to get this to work right. I am trying to use an IIF statement
in a query and it doesn't seem to work. I want the query to pull information
based on what the user chooses from a combo box.

IIf([Forms]![frmUserList]![Combo2]="all",is not
null,[forms]![frmuserlist]![combo2])

So if the user chooses anything other then "ALL", then I want the query to
pulled based on the name they choose but if they choose "all" then I want the
query to pull all non-blank data which should be everything. The second part
aseems to work but when i choose "All" i get nothing.

Any help would be appreciated.

Thanks

Like IIf([Forms]![frmUserList]![Combo2]="all", "*",
forms!!frmUserList!Combo2)
 

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