“Division by zeroâ€

G

Gonzalo

I have the following Expression in a query, Hours earned: Sum([Qty]/[UPH])

I want to add an IF statement that says if the value in UPH is 0 then
Sum([Qty]/[UPH]) = 0 , write now I’m getting a message that says “Division by
zeroâ€
 
K

Klatuu

In a Totals query, I think it would have to be styled a bit different, Jerry.

Hours Earned: Sum(IIf([UHP] = 0, 0,[Qty]/[UPH])

Are you and I the only ones not at the Summit :(
--
Dave Hargis, Microsoft Access MVP


Jerry Whittle said:
Hours Earned: IIf([UHP] = 0, 0,Sum([Qty]/[UPH]))
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

Gonzalo said:
I have the following Expression in a query, Hours earned: Sum([Qty]/[UPH])

I want to add an IF statement that says if the value in UPH is 0 then
Sum([Qty]/[UPH]) = 0 , write now I’m getting a message that says “Division by
zeroâ€
 
G

Gonzalo

You are correct, the way you styled it works, thank you.

Klatuu said:
In a Totals query, I think it would have to be styled a bit different, Jerry.

Hours Earned: Sum(IIf([UHP] = 0, 0,[Qty]/[UPH])

Are you and I the only ones not at the Summit :(
--
Dave Hargis, Microsoft Access MVP


Jerry Whittle said:
Hours Earned: IIf([UHP] = 0, 0,Sum([Qty]/[UPH]))
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

Gonzalo said:
I have the following Expression in a query, Hours earned: Sum([Qty]/[UPH])

I want to add an IF statement that says if the value in UPH is 0 then
Sum([Qty]/[UPH]) = 0 , write now I’m getting a message that says “Division by
zeroâ€
 

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