Sum field with some null values

G

Guest

I know this is pretty basic but help please. How do I sum a range of fields
in a report when some of them are null? My underlying table has the fields
as numbers but I don't want to see a whole bunch of zero's so I did a iif 0
make null, now it won't total across because some fields are blank. Can I
get around this? Thanks
 
A

Allen Browne

If you are trying to get a horizontal total across Field1 and Field2 and
Field3, use Nz() to specify zero for null, i.e.:
=Nz([Field1],0) + Nz([Field2],0) + Nz([Field3],0)
 
G

Guest

Wonderful, is there anywhere there is a dictionary of variables?

Allen Browne said:
If you are trying to get a horizontal total across Field1 and Field2 and
Field3, use Nz() to specify zero for null, i.e.:
=Nz([Field1],0) + Nz([Field2],0) + Nz([Field3],0)

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Akrt48 said:
I know this is pretty basic but help please. How do I sum a range of
fields
in a report when some of them are null? My underlying table has the
fields
as numbers but I don't want to see a whole bunch of zero's so I did a iif
0
make null, now it won't total across because some fields are blank. Can I
get around this? Thanks
 
A

Allen Browne

Not sure what you mean by a dictionary of variables.

If you mean a list of functions, Access 2003 has a good list in the help
file.
Open a code window.
Click the Help icon on the toolbar.
Look under:
Table of Contents
Microsoft Access Visual Basic Reference
Functions


--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Akrt48 said:
Wonderful, is there anywhere there is a dictionary of variables?

Allen Browne said:
If you are trying to get a horizontal total across Field1 and Field2 and
Field3, use Nz() to specify zero for null, i.e.:
=Nz([Field1],0) + Nz([Field2],0) + Nz([Field3],0)

Akrt48 said:
I know this is pretty basic but help please. How do I sum a range of
fields
in a report when some of them are null? My underlying table has the
fields
as numbers but I don't want to see a whole bunch of zero's so I did a
iif
0
make null, now it won't total across because some fields are blank.
Can I
get around this? Thanks
 

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