using WHERE with =sum function

  • Thread starter Thread starter Spidey3721
  • Start date Start date
S

Spidey3721

I have a form with two fields, NameID and VALUE.

I have a textbox in the footer that currently has "=sum([VALUE])".

Question: If I want to include all VALUE's with the associated NameID of,
say, "Apple" - could I add a criteria to this - =sum([VALUE]) WHERE
forms!NameID Not like "apple".
 
I have a form with two fields, NameID and VALUE.

I have a textbox in the footer that currently has "=sum([VALUE])".

Question: If I want to include all VALUE's with the associated NameID of,
say, "Apple" - could I add a criteria to this - =sum([VALUE]) WHERE
forms!NameID Not like "apple".

Instead, use a calculated field in the Query upon which the form is
based:

CondValue: IIF([NameID] = "apple", 0, [VALUE])

and sum this. (If, of course, NameID is a lookup field to a Name table
this won't work because your table does not *contain* the word "apple"
in any record.
 
That did it - Thank you for the help



John Vinson said:
I have a form with two fields, NameID and VALUE.

I have a textbox in the footer that currently has "=sum([VALUE])".

Question: If I want to include all VALUE's with the associated NameID of,
say, "Apple" - could I add a criteria to this - =sum([VALUE]) WHERE
forms!NameID Not like "apple".

Instead, use a calculated field in the Query upon which the form is
based:

CondValue: IIF([NameID] = "apple", 0, [VALUE])

and sum this. (If, of course, NameID is a lookup field to a Name table
this won't work because your table does not *contain* the word "apple"
in any record.
 
Back
Top