Divide by 0 (1 Viewer)

Toff

Registered User.
Local time
Today, 01:13
Joined
Aug 10, 2010
Messages
40
I know, I know, you cannot divide by 0. Its ok if you rolled your eyes at the title.

I have this:

Me![Mar_8] = IIf(Me![Mar_1] = 0, Null, Me![Mar_7] / Me![Mar_1])

It is still giving me a divide by 0 error.

Mar_1 is indeed 0 but it seems to be skipping the Null and still trying to do the division.

I'm sure I'm missing something easy ....

Could the Mar_1 field being set to Currency be confusing it?
 

Toff

Registered User.
Local time
Today, 01:13
Joined
Aug 10, 2010
Messages
40
Since the error only occurs by looking at previous years data then switching to current year, I decided to just Null out the offending fields prior to Calculating which my error code handles. Still have no idea why my IIf didn't want to work.
 

namliam

The Mailman - AWF VIP
Local time
Today, 08:13
Joined
Aug 11, 2003
Messages
11,695
IIF always and I do mean ALWAYS calculates both parts of the statement no matter if the result should be shown or not.

IT is a pain, but its the way it is
 

Brianwarnock

Retired
Local time
Today, 07:13
Joined
Jun 2, 2003
Messages
12,701
So to complete this, the only way is to use If..Then...Else
 

Toff

Registered User.
Local time
Today, 01:13
Joined
Aug 10, 2010
Messages
40
Doh, well I got around it another way.

Thanks all.
 

Users who are viewing this thread

Top Bottom