View Full Version : Calculate SUM in field on main FORM from SUBFORM with criteria???


haris
02-11-2002, 11:41 PM
Hello!
I have one problem! I have FORM and SUBFORM in that form with REFERENTIAL INTEGRITY. I have few fields in subform in datashet view! I SUBFORM I have field Amount and field Type! I have three choices on field Type and same same kind of values in Amount field! I would like calculate SUM in one field in MAIN FORM from Amount specified by criteria in field Type. I tried put for one criteria in one field in main form =DSum("[frmSub].[Form]![txtAmount]";"[frmSub].Form.RecordsetClone";"[frmSub].[Form]![txtType]='INVEST'"), but I always get an ERROR Massage in that field! I will be gratefull for answer!
Greetings from Sarajevo,
Haris

Rich
02-12-2002, 01:14 AM
Do the calculation in the subform footer. ie.
=Sum(Iif([Type]="Whatever",[Amount],0))
In the main form just set a text box to =[SubformName]![SummedControlName] Change the names to suit.
HTH