Well this is infuriating...bad totals on query

B

bugman

I'm sure I am doing something very basic wrong. I have a table that has
the fields "TotalNewHours", "TotalOldHours" and "CustNum". I have
created a query to show these fields plus a total of the 2 fields. The
total coulmn has the following calculation "Expr1: ([Total New Hours]+
[TotalOldHours])". The total comes out wrong in most cases. If there
is a value for both "TotalNewHours" and "TotalOldHours" the calculation
is correct. If there is only a value for "TotalOldHours" no calculation
is performed. It looks like a "Null" issue to me, but how can I fix it?
 
W

Wayne Morgan

Try changing the Null to a zero:

Expr1: Nz([Total New Hours], 0)+Nz([TotalOldHours], 0)
 
B

bugman

Nz([Total New Hours], 0)+Nz([TotalOldHours], 0)
Yup, that did it. I was trying, unsuccessfully, to put the Nz expresson
in both of the fields that were to be calculated so the 0's would be
used in the calculation. This works better, thanks!
 
Top