Report field to show total of other fields

J

JohnB

Hi.

I thought this should be simple but I can't get it to work.

I have a number of text fields that each show a number (sourced from a
DLookup) and I want to create another field that shows the total of the
content of these fields.

If I create the expression =[Text01]+[Text02]+[Text03] for the control
source of my totals field, it works provided all of those other fields have a
value. If at least one of them has no value, the total field is blank.

What am I doing wrong. Is there a better way to just add the value of
different fields, irrespective of them being empty or not?

Thanks.
 
D

Duane Hookom

Almost any time you add a Null into an mathmatic expression, you will get
wonky results. Your calculations sound very resource intensive but you could
change to something like:
=Nz([Text01],0) + Nz([Text02],0) + Nz([Text03],0)
If this doesn't work, you may need to wrap each Nz() inside Val(...)
 
J

JohnB

Thanks Duane.

That fixed it perfectly.

Cheers.

Duane Hookom said:
Almost any time you add a Null into an mathmatic expression, you will get
wonky results. Your calculations sound very resource intensive but you could
change to something like:
=Nz([Text01],0) + Nz([Text02],0) + Nz([Text03],0)
If this doesn't work, you may need to wrap each Nz() inside Val(...)
--
Duane Hookom
Microsoft Access MVP


JohnB said:
Hi.

I thought this should be simple but I can't get it to work.

I have a number of text fields that each show a number (sourced from a
DLookup) and I want to create another field that shows the total of the
content of these fields.

If I create the expression =[Text01]+[Text02]+[Text03] for the control
source of my totals field, it works provided all of those other fields have a
value. If at least one of them has no value, the total field is blank.

What am I doing wrong. Is there a better way to just add the value of
different fields, irrespective of them being empty or not?

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