Home > Software engineering >  I have recreated a query with four fields, how can i sum all the F1 to F4 in the query?
I have recreated a query with four fields, how can i sum all the F1 to F4 in the query?

Time:01-14

enter image description here i try to add but it returns blank as in field [Expr1]

CodePudding user response:

Use Nz to add 0 (zero) for empty fields:

Expr1: Nz([F1],0) Nz([F2],0) Nz([F3],0) Nz([F4],0)

CodePudding user response:

You can use the Nz function to return zero, a zero-length string (" "), or another specified value when a Variant is Null. so try:

SELECT Nz(F1) Nz(F2) Nz(F3) Nz(F4) AS Expr1
    From [Table1]
  • Related