Calculating fields

radicalrik

Registered User.
Local time
Today, 03:02
Joined
Apr 23, 2004
Messages
23
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.
 
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.
 
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!
 
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.
 

Users who are viewing this thread

Back
Top Bottom