totals from subforms onto main forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a subform with a calculated field in the footer being
"lblcrew_formula". One of my fields "crewrequired" in the subform refers to
this. What I am trying to achieve is to have the total crew required on the
main form. I have placed another calculated field in the footer "lblcrewtt".
This being =sum([crewrequired]), but when I then refer to this field on the
main report, all I get is "Error.

Can anyone please help?
 
Lynne said:
I have a subform with a calculated field in the footer being
"lblcrew_formula". One of my fields "crewrequired" in the subform refers
to
this. What I am trying to achieve is to have the total crew required on
the
main form. I have placed another calculated field in the footer
"lblcrewtt".
This being =sum([crewrequired]), but when I then refer to this field on
the
main report, all I get is "Error.

Can anyone please help?

To refer to the field on the subform, create a textbox on the main form
and set its ControlSource property to

=[yoursubformname]![lblcrewtt]

of course replace "yoursubformname" with the actual name of your subform.

Tom Lake
 
Have already tried that, and =[subformname]!forms.[crewtt] - being full path
to field on subform supposed to be holding the total. This doesn't work
either.

It seems to be that when I use the =sum([crewrequired]), it knocks it right
out. Am I doing something wrong here?

Tom Lake said:
Lynne said:
I have a subform with a calculated field in the footer being
"lblcrew_formula". One of my fields "crewrequired" in the subform refers
to
this. What I am trying to achieve is to have the total crew required on
the
main form. I have placed another calculated field in the footer
"lblcrewtt".
This being =sum([crewrequired]), but when I then refer to this field on
the
main report, all I get is "Error.

Can anyone please help?

To refer to the field on the subform, create a textbox on the main form
and set its ControlSource property to

=[yoursubformname]![lblcrewtt]

of course replace "yoursubformname" with the actual name of your subform.

Tom Lake
 
Lynne said:
Have already tried that, and =[subformname]!forms.[crewtt] - being full
path
to field on subform supposed to be holding the total. This doesn't work
either.

The full path would be

=Forms![mainformname]![subformname]![textboxname]

Make sure your text box names are NOT the names listed in the calculations:

crewtt should be the name of the textbox in the subform footer that holds
the sum. It cannot be a field name in the table.

Tom Lake
 
Have checked all that, and they're all unique.

What I don't understand is that even when I look at the total box in the
subform, it's also giving me #Error.

If I take the word sum out of the crewtt (total box in footer), then it
returns the value any of the records in the subform I click on. It's when I
put the =sum(etc, it goes bananas.

Tom Lake said:
Lynne said:
Have already tried that, and =[subformname]!forms.[crewtt] - being full
path
to field on subform supposed to be holding the total. This doesn't work
either.

The full path would be

=Forms![mainformname]![subformname]![textboxname]

Make sure your text box names are NOT the names listed in the calculations:

crewtt should be the name of the textbox in the subform footer that holds
the sum. It cannot be a field name in the table.

Tom Lake
 
If I take the word sum out of the crewtt (total box in footer), then it
returns the value any of the records in the subform I click on. It's when
I
put the =sum(etc, it goes bananas.

If you're trying to sum a calculated field, you have to repeat the
calculation in the Sum( function:

Example:

Qty Price Ea Total Price
5 7.00 =[Qty] * [Price Ea]

In Subform footer:
Order Total
=Sum([Qty] * [Price Ea]) ' Note: You
can't use Sum([Total Price])

On Main Form:

Grand Total
=Forms![mainform]![Order Total]

Tom Lake
 
Well, I must be having a really bad day or something, as I still can't get it
to work.

my formulas in subform footer are.....

"lblcrew_formula"
=-Int(-Forms![Filling Standard]!Line_Running_Speed/[Manaul])

This returns a whole number figure for me which is in the subform itself as
"crewrequired"

So my total field in the subform footer is "lblcrewtt"

=Sum(-Int(-Forms![Filling Standard]!Line_Running_Speed/[Manaul]))

and this is what is giving me the #Error in the field, without even refering
to the main form.



Tom Lake said:
If I take the word sum out of the crewtt (total box in footer), then it
returns the value any of the records in the subform I click on. It's when
I
put the =sum(etc, it goes bananas.

If you're trying to sum a calculated field, you have to repeat the
calculation in the Sum( function:

Example:

Qty Price Ea Total Price
5 7.00 =[Qty] * [Price Ea]

In Subform footer:
Order Total
=Sum([Qty] * [Price Ea]) ' Note: You
can't use Sum([Total Price])

On Main Form:

Grand Total
=Forms![mainform]![Order Total]

Tom Lake
 
Well, I must be having a really bad day or something, as I still can't get
it
to work.

my formulas in subform footer are.....

"lblcrew_formula"
=-Int(-Forms![Filling Standard]!Line_Running_Speed/[Manaul])

Is it possible you misspelled Manaul as Manual somewhere?

Tom Lake
 
Just goes to show it is a bad day, as it only appears twice, and both times,
I misspelt it. Have changed both instances now, and still no joy.


Tom Lake said:
Well, I must be having a really bad day or something, as I still can't get
it
to work.

my formulas in subform footer are.....

"lblcrew_formula"
=-Int(-Forms![Filling Standard]!Line_Running_Speed/[Manaul])

Is it possible you misspelled Manaul as Manual somewhere?

Tom Lake
 
Back
Top