data entry form format and null values

  • Thread starter Thread starter bbcrock
  • Start date Start date
B

bbcrock

I inherited a project that is badly coded.

I have a form with elements that are added together. The elements
cannot be null, but if the user deletes one, the field becomes null and
all calculations stop. the current format on the form element is

0.0;(0.0);-

How can I modify these fields to default to zero when the user deletes
the values in the field?

thanks,

Don
 
The Format property does not control what is entered. It only applies to the
value displayed. One approach would be to use the Input Mask property.
Another (My Prefered) is to wrap each element in the calculation in the NZ
function:

Instead of:
Me.txt1 + Me.txt2 * Me.txt3
Use:
Nz(Me.txt1,0) + Nz(Me.txt2,0) * Nz(Me.txt3,0)
 
I inherited a project that is badly coded.

I have a form with elements that are added together. The elements
cannot be null, but if the user deletes one, the field becomes null and
all calculations stop. the current format on the form element is

0.0;(0.0);-

How can I modify these fields to default to zero when the user deletes
the values in the field?



Use the Nz functio when you add the values.

=Nz(element1,0) + Nz(element2,0) + . . .
 
Back
Top