-
Solved: Sum Multiple Fields
I have been unsuccessful using sum and dsum in access. I have twelve fields in my form, january through december. I want to create a running total of the entered amounts. I think the problem is due to the fact only a few months contain data, such as january through march. The other fields are blank. I also attempted to do this in a query and no luck.
My field names in the form have simple labels, such as jan, feb, mar, apr, may, jun, july, aug, sept, oct, nov, dec, total. Does anyone have a simple and quick solution. Any help is greatly appreciated. Thank you in advance.
-
Will
Not all chemicals are bad. Without chemicals such as hydrogen and oxygen for example, there would be no way to make water, a vital ingredient in beer.
-
Thank you for your response. I will look into it.
-
brorick, are you trying to do this to put a total in a field on the form or a report?
-
-
As far as I can see you have two options to overcome your current problem.
1. remove the Null entries from the table with a global replace and replace the nulls with zeros. Add zero as the default entry on the Form for future records. Your calculations should then work OK.
2. Manipulate the current data including the Null values either at the query level or at the Form level with VBA code.
To do so at the query level the simplest way would be to add twelve new fields to the query one for each month and use this formula Expr1: IIf(IsNull([value 1]),0,[value 1]) in each column changing the field name for each one. Now you can simply add the new field values together, sum them or whatever.
-
Thank you OBP. I appreciate the response. I will definately try this method. Have a great day.
-
brorick, did it solve your problem?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules