Adding multiple fields

russell_piper

Active Member
Joined
Jul 15, 2002
Messages
259
I am a total noob to access and I have three fields that I would like to sum on a form.

Can anyone point me in the direction of how to do this. I have looked on help and it refers to the SQL or VB function.

I am using office 2003.

Thanks

Russ
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Had time to type an answer for you

I will give your three fields the names:
Orange . Apple . Melon

In “design view of your form create a Text box.
While the text box is highlighted right click on it and on the line named “Control source” type the following
=([Orange]+[Apple]+[Melon])
Now edit the names of your three fields to whatever you have named them.
Let me know how you did, you are the first person I’ve helped since I’ve joined this forum.
 
Upvote 0
Following on from the suggestion from isildad, if there is a chance one of the three values is null (i.e. empty), then you could modify the formula as follows :

=iif(IsNull([Orange]), 0, [Orange]) + iif(IsNull([Apple]), 0, [Apple]) + iif(IsNull([Melon]), 0, [Melon])

to detect and correct any such "null" values.

HTH, Andrew. :)
 
Upvote 0
Then if I want to use the field I have created in another sum how do I refer to it in a forumla.

If I take its name I get #Name? returned.

Thanks

Russell
 
Upvote 0
If you want the sum of a calculated field, Access wants all the details again.
Example: You create a field called [Citrus] with the expression =Nz([Orange])+Nz([Lemon]). You then want =Sum([Citrus]) and Access gives you the Name error.
Do this: =Sum(Nz([Orange])+Nz([Lemon]))

Note: Nz is Null to Zero -- gets around the problem of adding blank fields.

Denis
 
Upvote 0

Forum statistics

Threads
1,221,864
Messages
6,162,497
Members
451,770
Latest member
tsalaki

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top