NZ function not working

AnnPhil

Registered User.
Local time
Today, 14:10
Joined
Dec 18, 2001
Messages
246
I cant seem to get this to work, i have three fields and a total field in a form that will not total if one of the three have a null value.

field1+field2+field3 = field4, all are number data types, all have 0 default values.

Problem: if user needs to change or move a value from say field1 to field2, fields1 value is deleted and then entered in field2. The problem is that now field1 has a null value and then field4 which is the total does not calulate.

I tried using the NZ funtion on the after update event and no luck. Tried a couple other things and still no go. I am sure I am missing something simple, any help is appreciated.
 
How does some one "move" the value from a Text Box Control in a Form?

Maybe, a Zero can replace the value instead of moving it?
 
Try;
Code:
Field4 = NZ(Field1,0)+NZ(Field2,0)+NZ(Field3,0)

an alternate solution as suggested by PNGBill would be to set the default values for each of your fields 1 through 3 to Zero. Remember though that this will only ensure that all new records are populated with a value of zero, so you will need some code in the After Update event of each of fields 1 through 3 that looks something like;
Code:
If IsNull(Me.Field1) Then Me.Field1 = 0
 

Users who are viewing this thread

Back
Top Bottom