If - then statement

  • Thread starter Thread starter communities.microsoft.com
  • Start date Start date
C

communities.microsoft.com

I am having trouble creating an If-Then statement in a
Microsoft Office - Access 2000 Report. I am trying to
return one of two results based on the following logic:

If [TOTAL] > $10,000 is TRUE, then the returned result
should be ([TOTAL]-10,000)*5%)

If [TOTAL] > $10,000 is FALSE, then the returned result
should be (1000)

So far, I have tried this statement, but it comes back
with a general syntax error:

IIf ((Sum([Price]*[Quantity]))>10000), (1000+(((Sum
([Price]*[Quantity]))-10000)*5%)), 1000)

The (Sum([Price]*[Quantity])) line works in other cells,
so I don't think that is the problem.

Any help would be appreciated!

Thanks,

Sean
 
Sean,

Too many brackets.

IIf(Sum([Price] * [Quantity]) > 10000, 1000 + ((Sum([Price] * [Quantity]) -
10000) * 5), 1000)

Although I'm not sure if you need to explicitly use Sum(). If all you're
doing is multiplying Price by Quantity, then you don't, in which case, this
might suffice:

IIf([Price] * [Quantity] > 10000, 1000 + ((([Price] * [Quantity]) - 10000) *
5), 1000)

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


"(e-mail address removed)"
 
Back
Top