S.Hoitinga said:
Thanks for telling me Frank,
I only question: why haven't the access crew coped with this weird
problem?
In Excel a multiplication of 2 and 3.7 leads to 7.4 and nothing more or
less.
Regardless of the formatting, as it should be.
In access it seems to be a whole different story,
Actually, the different is you are now using a software development
tool..and not really a "end user" tool. It is a defense between going to the
store to purchase some Aspirin..and then learning the biology and medial
reasons behind why your throat gets sore when you are sick. (increased blood
flow as your body fights the infection causes the throat to swell..and, a
few other reasons). My point is that when you migrate from Excel to
ms-access, you are taking the next leap in terms of learning about software.
So, this is a issue of computers, and how numbers are resented.
"real" values in a computer are actually a appromaxaton. If you use integer
values
(or so called whole values), then a computer can do a much better job.
integer, long, and the currency data types in ms-access are actually stored
as whole numbers, and thus not subject to rounding...or approximate errors.
If you are doing any financial business software...you better learn this
lesson in a hurry. And, if you don't want to learn this lesson, then you
will have to leave software development to professionals.
What developers do is normally "hide" this complexity. And, your pocket
calculator, or Excel uses whole numbers..and shifts the results to reduce
the rounding errors.
In Excel a multiplication of 2 and 3.7 leads to 7.4 and nothing more or
less.
Actually, Excel has the same problem is you use the wrong data type.
While in excel, do the following, and jump to the VBA editor:
alt-f11
ctrl-g
Your cursor is now in the debug window for Excel, type in:
? ( (2.01 + .01) * 2 ) = 4.04
You will see that the above gives the answer of false. And, even if you are
NOT multiply numbers, try the following:
? ( (2.01 + .01) ) = 2.02
Again, the above suffers from serous rounding errors, and the above
expression actually returns false. The above is certainly not a complex
calculation...and yet we see that the above expression:
? ( (2.01 + .01) ) = 2.02
(2.02) = 2.02
2.02 = 2.02
And, yet..we get false!!!
So, excel most certainly can, and does suffer from rounding. This is a issue
of how computers work, and as a software developer we deal with this problem
every day....