Get control to sum up from control in subform?

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
 
S

Steve Schapel

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]
 
C

Chips

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
 
S

Steve Schapel

Chips,

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top