This is from an Access report designed to sort donors based on their node assignments within our campaign structure and add up total donations for each node.
Ex. –all donors who have given through direct mail “DM” fall under one node, and the report would add up all giving for direct mail.
Original expression (entered in the expression builder for a report in the group footer):
=Sum((IIf([struct]="ADT",[adt2006],IIf([struct]="DM",[indiv06],IIf(([struct]="GA" Or [struct]="NA" Or[struct]="TC"),([corp2006]+[wkpl2006]),IIf([struct]="OTH",([corp2006]+[wkpl2006]),IIf([struct]="PR",([corp2006]+[wkpl2006]+[indiv06]),IIf([struct]="UW" Or "ZZ",([corp2006]+[wkpl2006])))))))))
New expression:
=Sum((IIf([struct]="ADT",[adt2006],IIf([struct]="DM",[indiv06],IIf(([struct]="GA" Or [struct]="NA" Or[struct]="TC"),([corp2006]+[wkpl2006]+[indiv2006]),IIf([struct]="OTH",([corp2006]+[wkpl2006]),IIf([struct]="PR",([corp2006]+[wkpl2006]+[indiv06]),IIf([struct]="UW" Or "ZZ",([corp2006]+[wkpl2006])))))))))
If I enter one more variable (and it doesn’t matter what variable it is—I’ve tried several), the sum function returns an error value. I have no idea why this is occurring—I’m not sure if there is some kind of a limit on the Sum() or IIf() function?
But, if I enter a number instead of a variable, there is no problem….
=Sum((IIf([struct]="ADT",[adt2006],IIf([struct]="DM",[indiv06],IIf(([struct]="GA" Or [struct]="NA" Or[struct]="TC"),([corp2006]+[wkpl2006]+5555),IIf([struct]="OTH",([corp2006]+[wkpl2006]),IIf([struct]="PR",([corp2006]+[wkpl2006]+[indiv06]),IIf([struct]="UW" Or "ZZ",([corp2006]+[wkpl2006])))))))))
Can anybody figure out what the problem is?? Thanks in advance