By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,894 Members | 1,937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,894 IT Pros & Developers. It's quick & easy.

Access 2010 Compound Conditional

P: 2
I have code IIF(test,true, false)where true or false can be another IIF condition, The true or false for that conditional can also be another IIF. All conditions are seperated by "," and the expression ends with the corect number of ")" (one for each IIF). I get an error missing "bar" or "bracket" invalid syntax. I have tried another format using a ")" at the end of each secondary IIF and still get an error. The statement has 8 IIFs.

IIF([a]= [c], "True", IIF([b] = [d],"true",IIF([x] = [y],"true",IIF(........

I have also tried
IIF({a] = [c], IIF([d] = [e], "true", "False")
IIF([a] = [d], IIF([g] = [h], "true", "false")).....(four more IIFs follow.

Mar 31 '12 #1
Share this Question
Share on Google+
3 Replies

P: 2
I think I found the problem. There was an action for each true and false for each condition EXCEPT for the last condition; I was missing a "False" action for this condition.
Mar 31 '12 #2

P: 759
As an advice:
When create nested IIFs create it separately. Then, for bottom to top, nest its.
Expand|Select|Wrap|Line Numbers
  1. IIF([a]= [c], "True",)
  2. IIF([b] = [d],"true",)
  3. IIF([x] = [y],"true",LastResultIfFalse)

Now, cut the last IIF and paste into the false part to upper one:
Expand|Select|Wrap|Line Numbers
  1. IIF([a]= [c], "True",)
  2. IIF([b] = [d],"true",IIF([x] = [y],"true",LastResultIfFalse))

Repeat the operation:
Expand|Select|Wrap|Line Numbers
  1. IIF([a]= [c], "True",IIF([b] = [d],"true",IIF([x] = [y],"true",LastResultIfFalse)))

If this nested IIFs must be in a Query, use VBA editor until you obtain the code then paste this code into the query.
Apr 1 '12 #3

Expert Mod 15k+
P: 31,491
Doug, "What's the problem with this formula?" type questions don't work too well without the whole and complete formula being included ;-)
Apr 1 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.