Sure thing. I am noticing that MySQL document shows SUM() returns NULL for no matching rows, and we are testing for:
if expression <> "" then
instead of:
if IsNull(expression) then
or:
if expression <> Null then
More testing would be needed it seems. Or we fix the errors as they are reported.