Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / January 2008

Tip: Looking for answers? Try searching our database.

Access math

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
PilotBob - 07 Jan 2008 05:54 GMT
Very new to Access.  Trying to set up simple math functions but am getting
strange answers. For example: If I subtract 3446.1 from 3446.5 I get .4 which
is correct. However when I left click it shows 0.4000000091 This is used in
further calculations and throws all of the future calcs off.

3448.6 - 3447.9  gives .7  or 069999998

I have tried all of the various settings in properties (Integer, single,
double, etc..) The one that works best and gives the fewest errors is TEXT.
But this is clearly not text.

I would appreciate an e-mail response  if possible quest5a@earthlink.net
John W. Vinson - 07 Jan 2008 07:03 GMT
>Very new to Access.  Trying to set up simple math functions but am getting
>strange answers. For example: If I subtract 3446.1 from 3446.5 I get .4 which
[quoted text clipped - 6 lines]
>double, etc..) The one that works best and gives the fewest errors is TEXT.
>But this is clearly not text.

The examples above suggest that you were using either Double or Single.
Integer or Long Integer will not support any decimal places at all, and you
can't do math directly with Text (Access will convert the text string to
Double if you try).

Single and Double datatypes are "Floating Point" numbers. They're stored as a
binary fraction times an exponent; as such, they are *approximations*. Just as
the fraction 1/7 cannot be expressed exactly as a decimal fraction, so the
fraction 4/10 cannot be expressed exactly as a binary fraction - it's an
infinite repeating series of bits, just as .142856142856 is an infinite
repeating series of digits.

If you can settle for exactly four (no more, no fewer) decimal places, don't
use any of the Number datatypes but instead use a Currency datatype. It's a
scaled huge integer with a range into the trillions, offset to give four
decimal places. Or, with A2002 or later, you can use the Decimal datatype and
specify the precision and number of decimal places.

>I would appreciate an e-mail response  if possible quest5a@earthlink.net

That's considered an impolite request here. We're all volunteers, donating our
time to the newsgroups; I'm a self-employed consultant as are others. Private
email support is reserved for paying customers. Ask here... come here for the
answer (and let others benefit from the answer as well).

            John W. Vinson [MVP]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.