L
Laurel
I have a report that prints percent of days absent. I want to switch it to
percent of days present, but I get unexpectedly large numbers. It seems I
don't understand how the ## format works.
'The old way of doing it
fncDaysAbsentPercent = Format((Val(ls_absent) / Val(ls_enrolled)), "###%")
ls_absent = '1'
ls_enrolled = '8'
fncDaysAbsentPercent = 13%
'The new way of doing it
fncDaysPresentPercent = Format(100 - ((Val(ls_absent) / Val(ls_enrolled))),
"###%")
ls_absent = '1'
ls_enrolled = '8'
fncDaysPresentPercent = 9988%
I think I must have stumbled on a way of displaying absent percentages which
"worked" accidentally. Using numeric variables doesn't seem to help. The
following also gives me an unexpectedly large number.
ldc_debug = Val(ls_absent) / Val(ls_enrolled)
ldc_debug = 100 * ldc_debug 'This
equals 12.5
fncDaysPresentPercent = Format(ldc_debug, "###.##%") 'This
equals 1250.%
percent of days present, but I get unexpectedly large numbers. It seems I
don't understand how the ## format works.
'The old way of doing it
fncDaysAbsentPercent = Format((Val(ls_absent) / Val(ls_enrolled)), "###%")
ls_absent = '1'
ls_enrolled = '8'
fncDaysAbsentPercent = 13%
'The new way of doing it
fncDaysPresentPercent = Format(100 - ((Val(ls_absent) / Val(ls_enrolled))),
"###%")
ls_absent = '1'
ls_enrolled = '8'
fncDaysPresentPercent = 9988%
I think I must have stumbled on a way of displaying absent percentages which
"worked" accidentally. Using numeric variables doesn't seem to help. The
following also gives me an unexpectedly large number.
ldc_debug = Val(ls_absent) / Val(ls_enrolled)
ldc_debug = 100 * ldc_debug 'This
equals 12.5
fncDaysPresentPercent = Format(ldc_debug, "###.##%") 'This
equals 1250.%