Getting a total from subtotals - form/subform.

Talismanic

Registered User.
Local time
Today, 15:47
Joined
May 25, 2000
Messages
377
I have a sub form that is for time entry, the time is entered in the form and then shown in the sub form. The sub form is a data sheet with seven days mon, tue, etc... The very last field adds the values with this:

=(NZ([Mon],0)+NZ([Tue],0)+NZ([Wed],0)+NZ([Thu],0)+NZ([Fri],0)
+NZ([Sat],0)+NZ([Sun],0)).

The name of that field it txtSubTtl. Is it possible to get a total on the main form of all the subtotals in the sub form?

It would have to be something like this, =sum([txtSubTtl]). Of course that doesn't work, I am guessing because there are no references to the form or sub form so access doesn't know where to get the total from.
 
You could try the following:
=IIf(IsNull([LinkIDField]),0,DSum("[txtSubTtl]","QueryNameforSubform","[LinkIDField]=" & [LinkIDField]))

This will retrieve the information from your underlying query, since calculations are not stored. You might have to change your txtSubTtl field to the actual field name of where the times are being inputed.

Good luck.
 
I assume that QueryNameforSubform is the name of the subform but what is LinkIDField? Is that the field that the calc is done in?

By the way, the unbound field is named txtBottomTTl and the subforms name is QueryDataSub.
 

Users who are viewing this thread

Back
Top Bottom