K
KenC
Can someone explain to me why Access does not appear to
always add correctly?
I have an accounting file I work on and create the
following fields in my query;
AcctNbr
AcctNm
DrRecs: IIf(Amt >= 0, 1, 0)
DrAmt: IIf(Amt >= 0, Amt, 0)
CrRecs: IIf(Amt < 0, 1, 0)
CrAmt: IIf(Amt < 0, Amt, 0)
TotRecs: IIf(Amt, 0, 1, 0)
TotAmt: IIf(Amt, Amt, 0)
It isn't uncommon for me to get the correct answers in the
first 4 fields. But almost always I get the wrong answers
in the last 2 fields. Here are 2 examples;
100100 Bank1 24 $2,806,316.11
7,515 ($2.870.160.44)
7,539 ($63,844.30)
100200 Bank2 701 $169,493,971.79
14,798 ($166,121,438.69)
15,499 $3,372,533.77
Here the number of records totaled out correctly.
However, the amounts are obviously not right. Agreed that
the differences are minor, but they are wrong. If I
change my query and substitute -0.001 for the first zero
in each field the results are then correct. Why is this?
Also, this isn't an isolated case. This tends to happen
on all of the different accounting files I use.
An explanation would be appreciated, if one exists.
always add correctly?
I have an accounting file I work on and create the
following fields in my query;
AcctNbr
AcctNm
DrRecs: IIf(Amt >= 0, 1, 0)
DrAmt: IIf(Amt >= 0, Amt, 0)
CrRecs: IIf(Amt < 0, 1, 0)
CrAmt: IIf(Amt < 0, Amt, 0)
TotRecs: IIf(Amt, 0, 1, 0)
TotAmt: IIf(Amt, Amt, 0)
It isn't uncommon for me to get the correct answers in the
first 4 fields. But almost always I get the wrong answers
in the last 2 fields. Here are 2 examples;
100100 Bank1 24 $2,806,316.11
7,515 ($2.870.160.44)
7,539 ($63,844.30)
100200 Bank2 701 $169,493,971.79
14,798 ($166,121,438.69)
15,499 $3,372,533.77
Here the number of records totaled out correctly.
However, the amounts are obviously not right. Agreed that
the differences are minor, but they are wrong. If I
change my query and substitute -0.001 for the first zero
in each field the results are then correct. Why is this?
Also, this isn't an isolated case. This tends to happen
on all of the different accounting files I use.
An explanation would be appreciated, if one exists.