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

Invalid Syntax or Enclose Text Data in Quotes

P: 7
I have a query in which I am trying to return values for one of 3 conditions, <,> and =. See code below:

=IIf([CurrentProjectBudget]-[OriginalBudget]>0,"N/A"),IIf([CurrentProjectBudget]-[OriginalBudget]=0,"0.0%",IIf([CurrentProjectBudget]-[OriginalBudget]<0,[Text36]/[OriginalBudget],"0.0%"))

Access will accept the second to IIF statements without the first one, but will not accept the expression with all three conditions defined and returns "Invalid syntax or you need to enclose your text data in Quotes".

Can anybody help with this? Cheers!
Jul 10 '12 #1
Share this Question
Share on Google+
3 Replies


ariful alam
100+
P: 185
you did:

=iif(condition,true),false iif(condition,true, false iif(condition,true,false))

but it should like this:

=iif(condition,true,false iif(condition,true, false iif(condition,true,false)))
Jul 10 '12 #2

100+
P: 759
I can't debug your code but:

1) Create each IIF() as a new field in your query.
2) Test the functionality: each IIF() must return the expected results.
3) Copy the entire expression for the last IIF() in the desired part (part True or part False) of the previous IIF()
4) Remove the last field
5) Repeat steps 3-4 until you obtain only one IIF()
Jul 11 '12 #3

P: 7
Thanks to both ariful alam and Mihail. Between these two responses I was able to debug the problem and get the answer I was looking for. Cheers!
Jul 11 '12 #4

Post your reply

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