Conditional Subtotal in a Subform

DJ7T

Registered User.
Local time
Today, 20:20
Joined
Dec 5, 2001
Messages
11
I have two subforms in a form that track parts and labor for a computer service shop. These are totalled by putting a Sum function in a textbox in the subforms' footer, and then calling it in the main form. That works perfectly.

Now, I've added a "warranty" checkbox as you'll see below. The idea is to have the technician always specify all parts and labor spent, no matter if they're billable or under warranty. Therefore, we have the technicians specify all the parts and labor, and check "warranty" if the customer will not be billed.

servicesub.jpg

Above: The technician enters service labor. He may or may not check the "War" checkbox ("Warranty") to specify that the customer will not pay for that line item.

servicetotal.jpg

Above: Totals for parts and labor are calculated on the form and presented to the customer on a report.

Here's my problem. I'm trying to figure out what I need to do to that Sum function in the footer of the subform to make it total up *only* those lines that do *not* have the warranty checkbox checked. I have probably missed something very obvious, because Access' help is largely useless for finding information that's not in their "beginner" chapters, and I haven't seen a thread on the forums addressing this issue.

The subtotal textboxes have the following data sources in them:

=Sum([hours_in_house])
=Sum([hours_on_site])
(obviously, one for each field in the subform.)

Any help I can get on this will save the rest of the hair on my head from being pulled out ;-). Thanks.

-Mark
 
Sum(Iif([Warranty]=True,[hours_in_house],0))


[This message has been edited by Rich (edited 01-30-2002).]
 
That simple, eh? Thanks so much. You've saved me from a headache in the morning :-).

-Mark
 

Users who are viewing this thread

Back
Top Bottom