IIF in a query

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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)
 
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)
 
Back
Top