Hello friends,
I have an Access 2000 report that Must sum counts of "goals" and their corresponding "accomplishments" by control group (county=groupfooter0 in report) and final totals(groupfooter1). The problem is, it must also calculate a percentage of accomplishment (Number of individuals accomplishing the goal divided by the number of individuals with the goal.) The divisor sometimes is zero (no one had the goal) in the group or final totals.
In the group and final total footers, I have unbound text boxes to receive the down totals; example
ControlSource=Sum(SecureEmployment) which works fine for the column totals. For the division field, I first tried:
which works when there is a non-zero value in Sum(SecureEmployment) (the goal) but fails when there is a zero total. Next I tried:
as the obvious solution but at execution Access prompts for
sum(SecureEmployment) and the other sum in the IIF stmt. as parameters. I tried qualifying the field name as Sum(Me.SecureEmployment..... but that did not work, it still prompts me for Sum(Me.SecureEmployment).
I know it is theoretically possible to calculate one's own totals in VBA but I have just finished a 5 day horror trying to match the actual totals to what I get using VBA approach. Advice I've seen in various sources says "DO NO TRY TO DO THIS, IT WON'T WORK!". Typically the results of final totals are 2x, 3x or worse multiples of the county totals, AND sometimes the printed report will not match the Print Preview report. I tried using all the recommeneded methods of preventing these errors, (using PrintCount or FormatCount testing, using the Retreat event; no combination ever worked.
I have to be close; I know IIF works on a variable not in a SUM function. But I have to have the sum for the division.
What am I doing wrong, or not doing?
Thanks, hope someone has solved this before --
xbigblue
I have an Access 2000 report that Must sum counts of "goals" and their corresponding "accomplishments" by control group (county=groupfooter0 in report) and final totals(groupfooter1). The problem is, it must also calculate a percentage of accomplishment (Number of individuals accomplishing the goal divided by the number of individuals with the goal.) The divisor sometimes is zero (no one had the goal) in the group or final totals.
In the group and final total footers, I have unbound text boxes to receive the down totals; example
ControlSource=Sum(SecureEmployment) which works fine for the column totals. For the division field, I first tried:
Code:
=Sum(AccompSecureEmployment0/Sum(SecureEmployment)
Code:
=IIf([Sum(SecureEmployment)]=0,0,[Sum(AccompSecureEmployment)/Sum(SecureEmployment)])
sum(SecureEmployment) and the other sum in the IIF stmt. as parameters. I tried qualifying the field name as Sum(Me.SecureEmployment..... but that did not work, it still prompts me for Sum(Me.SecureEmployment).
I know it is theoretically possible to calculate one's own totals in VBA but I have just finished a 5 day horror trying to match the actual totals to what I get using VBA approach. Advice I've seen in various sources says "DO NO TRY TO DO THIS, IT WON'T WORK!". Typically the results of final totals are 2x, 3x or worse multiples of the county totals, AND sometimes the printed report will not match the Print Preview report. I tried using all the recommeneded methods of preventing these errors, (using PrintCount or FormatCount testing, using the Retreat event; no combination ever worked.
I have to be close; I know IIF works on a variable not in a SUM function. But I have to have the sum for the division.
What am I doing wrong, or not doing?
Thanks, hope someone has solved this before --
xbigblue