calculated total in query

S

Song

I have 2 fields in query. Qty1 and Qty 2. I added Total:qty1+qty2.
However, if qty1 has some number but qty2 is blank, my total is blank,
instead of just show the sum.
 
J

John Spencer

In Access

You need to use the NZ function to force a ZERO. Or use an IIF clause.

Total: Nz(Qty1,0) + Nz(Qty2,0)

or

Total: IIF(Qty1 is Null,0,Qty1) + IIF(Qty2 is Null,0,Qty2)

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top