# Division is not happening

L

#### LAS

The following control sources were cut and pasted here. For some reason
txtA is showing the value of the dividend instead of the value of
dividend/divisor. What might cause this? These controls are in a group in
the report. The sum() values are OK.

txtResult
=fncTotalSchoolTime("student",[student_id],"","")-(Sum([Excl])+Sum([Reint]))/fncTotalSchoolTime("student",[student_id],"","")
Report shows 660

txtDivisor =fncTotalSchoolTime("student",[student_id],"","")
Report shows 660

txtDividend
=fncTotalSchoolTime("student",[student_id],"","")-(Sum([Excl])+Sum([Reint]))

Report shows 637

J

#### John Spencer

I think you have to include some more parentheses to ensure the order of
calculation.

Division and multiplication occur before addition and subtraction.
Calculations happen within parentheses starting with the inmost set and
progressing outward.

A + B / C
Then the result is B divided by C then add in A. While what you might want is
the sum of A and B divided by C. To get that you need an expression like
(A + B) / C
A + (B / C)

(fncTotalSchoolTime("student",[student_id],"","")-(Sum([Excl])+Sum([Reint])))/
fncTotalSchoolTime("student",[student_id],"","")

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

L

#### LAS

Oh, wow. Thanks. I think this is one more symptom of my brain turning to
rice pudding. But it's working fine now!

John Spencer said:
I think you have to include some more parentheses to ensure the order of
calculation.

Division and multiplication occur before addition and subtraction.
Calculations happen within parentheses starting with the inmost set and
progressing outward.

A + B / C
Then the result is B divided by C then add in A. While what you might
want is the sum of A and B divided by C. To get that you need an
expression like
(A + B) / C
A + (B / C)

be
(fncTotalSchoolTime("student",[student_id],"","")-(Sum([Excl])+Sum([Reint])))/
fncTotalSchoolTime("student",[student_id],"","")

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
The following control sources were cut and pasted here. For some reason
txtA is showing the value of the dividend instead of the value of
dividend/divisor. What might cause this? These controls are in a group
in the report. The sum() values are OK.

txtResult
=fncTotalSchoolTime("student",[student_id],"","")-(Sum([Excl])+Sum([Reint]))/fncTotalSchoolTime("student",[student_id],"","")
Report shows 660

txtDivisor =fncTotalSchoolTime("student",[student_id],"","")
Report shows 660

txtDividend
=fncTotalSchoolTime("student",[student_id],"","")-(Sum([Excl])+Sum([Reint]))

Report shows 637