Where clause in calculation

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
 
A

Allen Browne

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.
 

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