I have a form that displays 0 by default in some fields, but not others. The default value property does not contain any variable. How do I suppres the 0 so that it does not display?
If the Default value property is blank then the Zero(0) is coming from the field in the table. The control source for the form object indicates which field is being displayed. If you do not want a zero(0) to show then you can change the display with a modification of the Format property to #,###. This will display a digit if there is one or nothing if the value is 0. Now the value of the field is still 0 but you are just displaying nothing.
What if 0 is an acceptable number for a field? I have many text boxes that will allow a 0 but I do not want it to display a 0 in every box that has not had anything entered into it. Makes my printout look a touch funny...
Go to the Table in design view for this field. In the Default Value for this field see if there is a 0. If so, remove it and see if it still shows up in your form.
Change the default value at the table level to Null. Problem is that this doesn't convert all of the already created records to this value. So, if you have a functioning database those records will have to be updated with a Null value in the numeric fields. Run a query to update the fields with Null.
Now you should get a blank in the beginning and a Zero(0) only when they enter a zero value.
You must take care if you are making calculations with this field setup this way. Nulls and Zero values must be tested for when using them in expressions. Functions like NZ, IIF, and Switch can be used to control errors that may crop up if used in an expression.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.