View Full Version : Calculating fields


radicalrik
04-23-2004, 02:22 PM
If I have a field called Maintenance Cost and I wanted to calculate what I'm spending monthly and add it to an existing report, how would I go about doing that. I have looked at the =Sum([maint]) but all it does is puts the total of the last record on the page, it does not calculate all the other records Maintenance fields.

RichO
04-23-2004, 03:42 PM
Are you wanting to calculate the sum of just one field [Maintenance] ?

You should be able to place a text box control in the report footer with the control source =Sum([Maintenance]) and that should give you the total sum of this field in the entire report. It will appear at the very end of the report.

Laftrip
05-04-2004, 09:49 AM
Is there a way to do this with strings instead of numbers?

For example, instead of adding numbers to have a total, I would rather concatenate strings to have an accumulated string instead?

I've looked and couldn't find a built-in function like Sum() for Concatenating strings. This should be a quickie for you experts out there!

RichO
05-04-2004, 06:19 PM
You would have to use VBA to concatenate the strings. As an example, in the report footer, add a text box control named txtConcStr

In the on format event in the detail section put:

Me.txtConcStr = Me.txtConcStr & Me.MyField

This will concatenate all of the occurences of "MyField" in the detail section.