Murray Brown
asked on
Access Sum not working as control source
Hi
I have an Access Report where the control source "[Invoice Details].[Amount]" works on a control but "=Nz(Sum([Invoice Details].[Amount]),0)" does not.
It causes an error. This makes no sense to me.
Thanks
I have an Access Report where the control source "[Invoice Details].[Amount]" works on a control but "=Nz(Sum([Invoice Details].[Amount]),0)" does not.
It causes an error. This makes no sense to me.
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Maybe it needs to be:
=Sum([Amount])
=Sum([Amount])
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Correct but in that case, you will have to use Nz() if Field1 or Field2 might be null because because Access performs the addition operation first and that will fail if either field is null event though the sum() handles nulls by ignoring them.
Sum(Nz(Field1,0) + Nz(Field2,0))
Sum(Nz(Field1,0) + Nz(Field2,0))
As a side note I was assuming [Amount] is the Field name ....
ASKER
Thanks for the advice
What was the actual problem ?
Is the control bound ?
Did you try with an unbound control and a query ?