Calculation

Thedon123

Registered User.
Local time
Today, 02:14
Joined
Sep 11, 2002
Messages
98
I ahve a calculation on my form that is formed by data in the form and subform.


I have a total value at the end that adds together all the values.


I do not have to enter of the values as they are not compulsory.

the problem arises as i cannot a total displayed because one of the values is not filled.

i have the expression = ([Part]+[Value]+[prog]+[TOT]) in the total unbound text box. If i donot enter the the value of prog it does not give me the total.

how would i get the total even if only 3 values are entered instead of the forth.
 
Hello,

Access can't add a null value, which is different to a zero.

I have two thoughts:

1. Set your default value for each of the four figures to zero, then it will never be null, and the addition will work - note: you will have to go back and amend the records already entered as default values only kick in on creation of the record.

2. Have your code look like this:
value = iif(isnull([Part]),0,[part])+iif(isnull([Value]),0,[value])+iif(isnull([prog]),0,[prog])+iif(isnull([TOT]),0,[total])
That prevents access trying to add null values.

Good Luck
Anna
 
You should also look up the Nz function
 

Users who are viewing this thread

Back
Top Bottom