Calculations with some fields empty

A

Anthony

Hi,
I have a form that has several fields that contain prices but sometimes i
dont use them all, the problem i have is i can get it to add all the fields
as long as all the fields have a number in them but not when one or more
fields or null.
Does anybody know of an alternative to make the 'total' field add all the
fields treating the null fields as 0.

The code i've been trying is setting the control source of the 'total' text
field as: =[amount1]+[amount2]+[amount3] etc.

Thanks guys in advance.
 
A

Allen Browne

Use the Nz() function to tell Access to use a zero for Null:

=Nz([amount1],0) + Nz([amount2,0) + Nz([amount3],0)
 
A

Anthony

Thanks Allen saved me a lot of time......would you believe i have your old
site at bigpond in my favourites.......i've updated the favourite...thanks
again...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top