Get control to sum up from control in subform?

  • Thread starter Thread starter Chips
  • Start date Start date
C

Chips

I want a control to sum values from a subform in Access 2000.

I have a form that contains a subform. I want to make a control sum up the
values in a control in the subform.

I have it referring to it with

=[Forms]![FrmSbEmpWE]![FrmSbWkInstance]![EmpHrs].

But it's only displaying the value of the top record in the subform. I want
it to sum up all the records in the subform that are tied to a particular
record in the parent form.

I tried =sum([Forms]![FrmSbEmpWE]![FrmSbWkInstance]![EmpHrs]) and that gave
me an error.

Any clues here?

Thanks,

GC
 
Chips,

Put an unbound textbox in the Header or Footer section of the subform,
with its Control Source set to...
=Sum([EmpHrs])
Let's say the name of this textbox is TotalHours. You can set its
Visible property to No if you like.
Then, on the main form, put the Control Source of the textbox to...
=[FrmSbWkInstance]![TotalHours]
.... or, as some would have it...
=[FrmSbWkInstance].[Form]![TotalHours]
 
Thanks, and what are you doing up so late?

GC


Steve Schapel said:
Chips,

Put an unbound textbox in the Header or Footer section of the subform,
with its Control Source set to...
=Sum([EmpHrs])
Let's say the name of this textbox is TotalHours. You can set its Visible
property to No if you like.
Then, on the main form, put the Control Source of the textbox to...
=[FrmSbWkInstance]![TotalHours]
... or, as some would have it...
=[FrmSbWkInstance].[Form]![TotalHours]

--
Steve Schapel, Microsoft Access MVP

I want a control to sum values from a subform in Access 2000.

I have a form that contains a subform. I want to make a control sum up
the values in a control in the subform.

I have it referring to it with

=[Forms]![FrmSbEmpWE]![FrmSbWkInstance]![EmpHrs].

But it's only displaying the value of the top record in the subform. I
want it to sum up all the records in the subform that are tied to a
particular record in the parent form.

I tried =sum([Forms]![FrmSbEmpWE]![FrmSbWkInstance]![EmpHrs]) and that
gave me an error.

Any clues here?

Thanks,

GC
 
Chips,

It wasn't all that late where I live ... looks like I posted my reply at
8:50pm Sunday :-).
 
Back
Top