Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IIF Statement Query Problem 1

Status
Not open for further replies.

southbean

Technical User
Jun 3, 2005
147
US
Hello All,

I’m having difficulty trying to get an IIf Statement to work. The user has the option of choosing “All” to return all values pick a specific value from a list of 8 values from a combo-box dropdown. The following code works fine.

Code:
Like IIf([Forms]![frm_List]![ComboBox]="All","*",[Forms]![frm_List]![ComboBox]))

However, I’d like to combine 3 values into one. For example, if I put “Request 1-2-3" as a value in the drop-down list, I’d like the query to return values for "Request 1","Request 2" and "Request 3".

I tried to write something like this, but it does not work:

Code:
Like IIf([Forms]![frm_List]![ComboBox]="All","*",IIf([Forms]![frm_List]![ComboBox]="Request 1-2-3",("Request 1","Request 2","Request 3"),[Forms]![frm_List]![ComboBox]))


Any/all help or suggestions would be GREATLY appreciated!

Thanks,

- Tom
 
Something like this (SQL code) ?
SELECT ...
WHERE ([Forms]![frm_List]![ComboBox]='All'
OR ([Forms]![frm_List]![ComboBox]='Request 1-2-3'
AND [your request field] IN ('Request 1','Request 2','Request 3'))
OR [Forms]![frm_List]![ComboBox]=[your request field])

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV,

Thanks very much for your reply! I had to tweak it a little to get it to do what I needed, but your code got me on the right path.

Thanks again!!!

- Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top