Allen Browne Running Total on subform won't work

  • Thread starter Thread starter T
  • Start date Start date
T

T

I have 3 fields in a subform that hours are entered. I
also have one field on the subform that totals all the
hours entered in each of those record. I would like to be
able to have a running total of all hours entered on the
form I have tried the sum function and dsum and can't get
it to work Can someone help ? Mr Browne this is what I
tryed

=Sum(Nz([Executive Flight Hours]),0) + Nz(Sum([Law
Enforcement Hours]),0) + Nz(Sum([Aid to Other Agency
Hrs]),0) It gives me an error
Thanks for your help
 
Where did you place this text box? (What section?)
What is its name? (Can't be the same as any field in the subform's
RecordSource)

What is the RecordSource of the subform? Table or query?
Are the 3 fields in the Record Source? Is that their names? Are the text
boxes on the form showing the same names?

Are there any records in the subform when you get this error?
 
Where did you place this text box? (What section?)FOOTER
What is its name? (Can't be the same as any field in the
subform's TEXT20
RecordSource)

What is the RecordSource of the subform? Table or query?
TABLE
Are the 3 fields in the Record Source? Is that their
names? Are the text
boxes on the form showing the same names? YES

Are there any records in the subform when you get this
error? YES SEVERAL
 
Double check it is in the Form Footer section, not the Page Footer section.

Try getting one at at time, until you find the source of your problem, e.g.
try:
=Sum([Executive Flight Hours])
as the Control Source.

Once that's working, add the Nz(), i.e.
=Nz(Sum([Executive Flight Hours]), 0)

Then try the others.
 
Try using DSum again in a text box. You will need to
reference your query where the records are stored. Also,
make sure you reference your subform, or the running total
will only work in the subform but not the parent form.
Here is an example of one that I used to get a running
total hours for an employee. The employee's total hours
were divided out by year, and I had multiple employees in
the query. You should be able to modify this for your
form.

=DSum("[Hours]","[qrySubHrs]","[EEID]=Forms![frmHRS]!
[frmSubHrs]![EEID] And [Year]<=Forms![![frmHRS]!
[frmSubHrs]![Year]")
 
Back
Top