Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Total In Subform with criteria

Status
Not open for further replies.

buzzboychicago

Programmer
Sep 20, 2004
34


Hi, I have an unbound field in a subform header that I want to have a running total in.

Most people suggest using
=Sum([Quantity] in the field source

But, I'd only like the to be added if another field in that subform meets a certain criteria.

Does anyone know a good way to go about this.

If you are suggesting I use SQL stuff, I don't really understand how to 1) reference the subform in SQL and 2) how to send the final value of the recordset I create to the unbound field.

Lemme know. Thanks ahead of time for your help!
 
Take a look at the DSum function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I have tried just now...I can't get the syntax right.

DSum(expr, domain, [criteria])

(I think it would work if it weren't a subform. How do I let it know that were talking about the subform and not make access look for the total in a form

I tried various methods...

DSum("[CallQuantity]", [CallTableSubform], "[CallType]= 'Ben'")

as well as being really thorough and typing

DSum("[CallQuantity]","Forms![CustomerBracket]![CallTableSubform]","Forms![CustomerBracket]![CallTableSubform].Form![CallType] = 'Ben'")

I'm also trying to place it in the on current event of the subform.

 
The second argument must be the Query/Table name.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top