Expression

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have five fields:
Beginning of month End of Month On Hand Ordered Used
7 11 6
On Hand and Used are calculated fields from the other 3 fields. Now if I
input the beginning of month, end of month & ordered amount with the above
numbers I get the following:

On Hand Used
5 2

And this is correct and what I want the calculations to do. But if I put in
the following numbers:
Beginning of Month End of Month Ordered Amount
7 11 2
I get the following from my calculations:
ON Hand Used
9 -2

And I understand that I am getting a negative number because in reality
there wasnt any used. So what I need to know is how to I setup an expression
so if ON HAND is > Beginning of Month that it will input a '0' in Used. I
tried using the Expression Buileder for the Used field with the following:
[Jan On Hand]>[Jan Beginning of Month]=0
but either I didnt put it in the right place or it just didnt work. Can
anyone pleeeeeese help me with this? Thank you a million.
 
Hi, nbuwalda.

See VBA Help on the IIF function, whose syntax is:

IIf(boolean expression, value if expression true, value if expression
false), so assign the control the expression:

=IIF([OnHand]>[BeginningofMonth],0,[OnHand]-[BeginningofMonth])

Hope that helps.
Sprinks
 
Back
Top