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

How do I Display Negative Values as Zero (0)

P: 2
I'm creating a form for a library system and in my form i would like to show the over due days of a borrowed book. I calculate that from the following equation:-
overdue days = return date - due date
(correct me if i am wrong)
and i get negative numbers for books that are not over due.
How to change that negative values to zero?
Feb 22 '12 #1
Share this Question
Share on Google+
2 Replies


TheSmileyCoder
Expert Mod 100+
P: 2,321
This is based on Ac2003, but I feel fairly confident it should work in Ac2007 as well.

You can specify the number format to use for the textbox. Select your textbox and in the property sheet find the format property and type in the following:
#;\0;\0;\0
You can see there are 4 semicolon-seperated values. The order specifees the format for:
Positive Numbers: # display the number
Negative numbers: Display a 0
0 : Display a 0
Null: Display a 0

I think that should work fine for you.
Feb 22 '12 #2

NeoPa
Expert Mod 15k+
P: 31,308
Smiley's suggestion is a clever one, and will work as long as you don't need to store the value shown.

It will show you what you want to see, but it won't change the actual data in the control. That means the value will still be negative, even though all that shows is the zero (0).
Feb 23 '12 #3

Post your reply

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