If value is a negative number, display 0

ScrmingWhisprs

I <3 Coffee Milk.
Local time
Today, 04:19
Joined
Jun 29, 2006
Messages
156
On my "timesheet" for my volunteer database, I have a textbox called HoursRemaining. It's control source is
Code:
=[HoursRequired]-[HoursCompleted]
That works great. Occationally however, the volunteer will complete more hours than required. Instead of displaying a negative number, I would like HoursRemaining to display 0.

Can this be done?

Thanks
ScrmingWhisprs
 
Code:
=IIF([HoursRequired]-[HoursCompleted])<0,[HoursRequired]-[HoursCompleted],0)
 
That code isn't working. First off, it was missing an open paranthesis, once I fixed that, all of my results are coming up as 0, except for the ones that are negative. So now it's only showing the negative values.

Am I putting this as the control source for that textbox?
 
Nevermind!!! I figured it out!!! I just switched <0 to >0. It just dawned on me the logic of that statement.

Thanks for your help!!!
ScrmingWhisprs
 

Users who are viewing this thread

Back
Top Bottom