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

#error in query 1

Status
Not open for further replies.

KimVong

IS-IT--Management
Sep 13, 2002
90
US
How can I make the #error in my query to equal to zero. The reason why it give me a #error becuase I some of my field is divided by zero.

any help is great

 
We can fix that a couple of ways. Please post your SQL and identify the column that is causing the problem.

Bob Scriver
 
select amtsold, price, [price]/[amtsold] as pf from table1

the column that I have a problem is the column with [price]/[amtsold], if the division is not by zero, then the number come out correctly, if it is divided by zero, then it shows #error in the query output
thanks for replying

 
Try this:

select amtsold, price, IIF([amtsold]= 0, 0,[price]/[amtsold]) as pf from table1

This will analyze [amtsold] first and if zero(0) return a 0 else perform the division.

Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top