Where clause in calculation

  • Thread starter Thread starter Mary
  • Start date Start date
M

Mary

I have a subtotals form and I'd like to grab the related fields for field1
based on the value in field2.

Sum([field1]) Where [field2]="Retail"

I've used a where clause in a query after the FROM, but never on a form. Is
this possible?

Thanks!
Mary
 
Set the Control Source of your text box to:
=DSum("Field1", "Table2", "field2 = 'Retail'")

Naturally, you don't want to store this value in this table, since that
would create maintenance problems trying to ensure it was always up to date.
 
Back
Top