Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DIV by Zero??? 1

Status
Not open for further replies.

WB786

MIS
Mar 14, 2002
610
I know you can use the following to mask the error:

=IIf([MeterHours]=0,"0",[TotalGallons]/[MeterHours])

But I also need it to do the same if the value in MeterHours is Null. So whether the MeterHours is Null or Zero it should put a Zero there instead.

Thank you in advance,

:)WB
 
Try (typed, not tested)

=IIf(Nz([MeterHours],0)=0,"0",[TotalGallons]/[MeterHours])


If my syntax is wrong...look at the Nz function

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
WORKED LIKE A CHARM!!!

THANKS!!!

:)WB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top