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

Overflow error? 1

Status
Not open for further replies.

GaborH

Technical User
Nov 5, 2003
48
0
0
US
I am getting an overlow error, and have no idea what starts this problem, or how to go about solving this.
My data is simple,

1) table with three fields
prod_no txt
qty number/double
lcm_cost number/double

2) Query1 that groups prod_no, and sums qty and lcm_cost

3) Query2 divides lcm_cost/qty by IIf(IsNull([SumOfQty]),0,([SumOfLCM_AMOUNT]/[SumOfQTY])), and this is the query where I get the overflow error.

I have changed Query1 so the criteria for qty is >0, and this seems to have solved it. But I am not sure what was wrong in the first place.

Please, any hints are highly appreciated!

GaborH
 
IIf(IsNull([SumOfQty]),0,([SumOfLCM_AMOUNT]/[SumOfQTY]))

This returns 0 (i.e. no division is carried out) if SumOfQty is Null, but allows the division to go ahead if SumOfQty is 0.

Try:

IIf(Nz([SumOfQty],0)=0,0,([SumOfLCM_AMOUNT]/[SumOfQTY]))


Hope this helps.
 
Thank you, that worked great!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top