total amt in subform

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

Guest

Hello. I have a subform that is the many to the main forms one. One field
on the subform in the footer is a textbox that provides a total of a field in
the subform. This works fine. What I am doing now is adding another field
to the subform footer to provide a total of the same field but only if a
combobox in the subform has a specific value in it. Now, I am confused and
seek assistance from the newsgroup. Appreciate any assistance.
*** John
 
"if a combobox in the subform has a specific value in it"
Is the combo box bound to a field in the subform's record source?

Generically, you can use an expression like:

=Sum(Abs([SomeField]="a specific value") * [FieldToSum])

If SomeField is numeric, remove the quotes from around "a specific value".
 
Hello. I have a subform that is the many to the main forms one. One field
on the subform in the footer is a textbox that provides a total of a field in
the subform. This works fine. What I am doing now is adding another field
to the subform footer to provide a total of the same field but only if a
combobox in the subform has a specific value in it. Now, I am confused and
seek assistance from the newsgroup. Appreciate any assistance.
*** John

I'd suggest you add a calculated Field in the query upon which the
form is based. You can't sum *controls* on a Form; you can sum *values
in a field*. If you put a calculated field in the Query such as

ConditionalSum: IIF([otherfield] = "Foo", [sumfield], 0)

and put

=Sum([ConditionalSum])

in the subform footer, it will sum only those rows where the
otherfield (the one you're using with the combo box) is equal to
"foo".

John W. Vinson[MVP]
 

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

Similar Threads

subform total behaving strangely 2
subform totals to popform 1
Null Value in Subform Total 4
subform total 5
textbox event 2
Timing of update of subform totals 2
Access 2007 subform total. 4
wrong subform total 2

Back
Top