March 31, 2015 at 3:04 am
Hi!
I have some table with a column in it of type "real". For example, I have value "0.22" in this column.
When I import this table to Excel worksheet (with Range.CopyFromRecordset method), then this values becomes "0.219999998807907".
However, when I import this table into Microsoft Access, then I get correct value - 0.22. Also, when I use "float(25)", then the values was correct - 0.22, but in case of float(25) I increase space storage (from 4 bytes to 8 bytes). But even more important thing - I can't know whether it would help.
I know that I could use, say, decimal or money, or convert this values "on-the-fly" but this is not the solution (because I would be forced to enumerate all columns which are 30-40 for each table!). The thing is that Range.CopyFromRecordset is the fastest way for importing data, thus I would like to have all things working correctly "out-of-the-box".
Is there some neat solution so that I could continue using "real" data type?
Thanks beforehand.
March 31, 2015 at 11:01 am
It's the nature of the data types you're using. Float point or "approximate" data types handle values differently than "precise" data types.
The fact that one example happens to store that particular value exactly is purely happenstance. Store another value in that float(24) and you will likely see something similar to what REAL did.
https://msdn.microsoft.com/en-us/library/ms173773.aspx
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply