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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enter zero instead of #error

Status
Not open for further replies.

ardagh

IS-IT--Management
Jun 15, 2004
22
IE
I have a database which is used by operators to input manufacturing data i.e. LotNo, Customer, SalesOrderNo, PartNo, LineNo, ActualQty, Length, ScrapMat, (MatStdCost), StdLineSpeed, SetupTime, RunTime, LostTime and weightperpiece.

We then use this data to produce information like
Standard Run Time: (([ActualQty]*[Lenght])/[StdLineSpeed])/60
Machine Efficiency: ([Standard Run time]/[Runtime])

these work fine if values are inserted. The problem is that when a value is zero it returns a #error value in the field. This is probably caused by dividing by zero which can happen.

A test may occur where there is zero StdLineSpeed etc.

Is there any way I can bet access to return zero in these cases instead of the #error because I wish to do further calculations on totals and averages and I cannot if even one #error occurs.

Any suggestions or help would be appreciated.

Regards
Niall
 
Standard Run Time: IIF([Lenght]=0,0,(([ActualQty]*[Lenght])/[StdLineSpeed])/60)
Machine Efficiency: IIF([RunTime[=0,0,([Standard Run time]/[Runtime]))




Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Or safer still:

Standard Run Time: IIF(Nz([Lenght],0)=0,0,(([ActualQty]*[Lenght])/[StdLineSpeed])/60)
Machine Efficiency: IIF(Nz([RunTime],0)=0,0,([Standard Run time]/[Runtime]))


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
More safer, replace this:
IIF(Nz([Lenght],0)=0
By this:
IIF(Nz([StdLineSpeed],0)=0

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thank very much

It seems to be working fine - returning a value of 0.

I used the Nz function as you suggested.

Again thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top