Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / April 2008

Tip: Looking for answers? Try searching our database.

“Division by zero”

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gonzalo - 16 Apr 2008 20:53 GMT
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”
Jerry Whittle - 16 Apr 2008 20:59 GMT
Hours Earned: IIf([UHP] = 0, 0,Sum([Qty]/[UPH]))
Signature

Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

> 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”
Klatuu - 16 Apr 2008 21:51 GMT
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 :(
Signature

Dave Hargis, Microsoft Access MVP

> Hours Earned: IIf([UHP] = 0, 0,Sum([Qty]/[UPH]))
>
[quoted text clipped - 3 lines]
> > Sum([Qty]/[UPH]) = 0 , write now I’m getting a message that says “Division by
> > zero”
Gonzalo - 17 Apr 2008 00:59 GMT
You are correct, the way you styled it works, thank you.

> In a Totals query, I think it would have to be styled a bit different, Jerry.
>
[quoted text clipped - 9 lines]
> > > Sum([Qty]/[UPH]) = 0 , write now I’m getting a message that says “Division by
> > > zero”
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.