Overflow error

T

Thrava

I'm running a query that gives an error message saying
overflow.

I narrowed down the problem to the fact that I am doing a
division and that the denominator of one of the fields may
be zero.

right now the formula in the query pane is: MarketShare:
[totalmarket]/[our_share]. The problem is that this query
gives market share calculations based on various
territories.... so if one of the territories has a zero
for the [our_share] field, it gives me this error.

How can I fix this so that if there is a zero, that it
would ignor and give me either a Null for that territory
or an "N/A"?

thanks
 
N

Norman Yuan

In the SELECT...statement, use

SELECT ...,IIF([our_share]=0,NULL,[totalmarket]/[our_share]) AS
MarketShare,..FROM tblXXXX WHERE...
 
T

thrava

Thank you. This worked like a charm. Much appreciated it.

-----Original Message-----
In the SELECT...statement, use

SELECT ...,IIF([our_share]=0,NULL,[totalmarket]/ [our_share]) AS
MarketShare,..FROM tblXXXX WHERE...

I'm running a query that gives an error message saying
overflow.

I narrowed down the problem to the fact that I am doing a
division and that the denominator of one of the fields may
be zero.

right now the formula in the query pane is: MarketShare:
[totalmarket]/[our_share]. The problem is that this query
gives market share calculations based on various
territories.... so if one of the territories has a zero
for the [our_share] field, it gives me this error.

How can I fix this so that if there is a zero, that it
would ignor and give me either a Null for that territory
or an "N/A"?

thanks


.
 
Top