By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,489 Members | 1,932 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,489 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.

Suggestions?
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

100+
P: 759
As an advice:
When create nested IIFs create it separately. Then, for bottom to top, nest its.
Example:
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

NeoPa
Expert Mod 15k+
P: 31,186
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.