So if you understand why Decimal was best implemented as a reference type
<<<
I don't (at least with a comfortable degree of confidence), But I am always
willing and eager to learn!! (I ASSUME its along the same lines as to why a
memo type is basically a pointer to an addres that begins a huge block of
information) ... It is quite obvious that your knowledge level on the topic
of data types and there implementation goes much deeper than mine ...
...
but that does not mean that my advice to utilize the currency datatype is
incorrect or undesireable. On the flip side, your defense of the decimal
data type generates no disagreement from me. But, lets remember that the OP
is keeping track of Hours worked, which I hardly beleive will require a 12
Byte 38 digit precision! ... In that regard I'm sure it will not require the
full consumption of an 8 byte currency type either!... The field could
probably be declared as an Integer (2-bytes) and record the value in minutes,
or as a "psuedo scaled-integer" via the format/input mask (ie: the user input
16, but display the value as 1.6) ... if the "psuedo scaled-integer" approach
I just mentioned would be used, you could probably even use the Number/Byte
type!
As indicated above, my depth of knowledge with respect to the interworking
and implementaion of data types/hardware support etc. does not equal yours.
I am, at most, a skilled amateur who's technical world is dominated by
MSAccess/VBA/SQL Server and Human Machine Interfaces/OPC servers ... heck ...
I can't even create a web page!!! But I can do some killer stuff in
MSAccess!! Ultimately I can honestly say that I know a bunch of stuff, but I
definately have a lot to learn. With discussions like this, I beleive we all
benefit. You, me and the readers get a chance to exercise our minds by
putting what we know in a post for the world to see. Then, as information
is shared, it is absorbed into those minds that want to learn. Then, those
who gain more knowledge, can help others ... you know ... the "Pay it
Forward" concept.
They don't have to ... but the more they "line up" the easier it is to
create your code ... at least until you know how the data types match up ...
after all in table design (remember I am MSAccess centered!) the "Yes/No"
datatype is a "Boolean" in VBA ... not a direct match, from a text
description point of view!!
smoke screen. <<
... and ..impression you read Allen Browne's biased attempt to discredit the
DECIMAL type <<
... and ..
Despite the fact you indicated you stated the above "respectfully" ... it
does not seem respectful to make the assumption that I hiding behind a smoke
screen; can not form my own opinions/preferences; nor perform any "research".
Please accept that I, in know way intended, nor intend, to "put up a smoke
screen"!! If I was trying build a "smoke screen" I would NOT have linked to
the article! I would have merely cut/paste with out reference to anyone! If
I did not do research, then I would not have found Mr. Brownes' article! Nor
is my info an attempt to discredit the DECIMAL data type. My info stated MY
lack of desire to use that data type and why I have that view point. Which,
hopefully, will allow the OP to make an informed/educated decision before
they use it ... I, like you, present the information I have knowledge of ...
Was my "research" "deep enough"? It was at the time I found it! <g> The
depth of my research satisfied my curiousity for the given subject .. but
apparently not deep enough to equal the knowledge you, and others I assume,
possess, thus your reply to help improve a readers (including me) knowledge.
I am always eager to learn more information about all this stuff, which
ultimately will form my opinions and techniques while developing apps, and I
truly appreciate your willingness to share your information, but I was a
little taken back with the assumptions made towards me. I respect the
knowledge that you have displayed in this thread and if my verbage and style
of presentation in my responses has come accross as "my opinion is superior
to yours" I apologize ... my intent with participating in public
forums/groups is merely to expand & share my knowledge ... if what I share
with others is INCORRECT or INCOMPLETE, then I HOPE other folks, like you, to
jump in and educate the readers and me .... thats why we are here!! .... "Pay
It Forward!"
Nope ......... I'd use the DECIMAL data type ..... <g> .... There is this
person named Jamie on the boards that can help me with implementation! ....
--
Kind Regards,
Brent Spaulding
datAdrenaline
Jamie Collins said:
datAdrenaline said:
in MSAccess VBA the Decimal datatype
is not supported directly ... you have to declare a variant, then use CDec()
to coerce the variant into a decimal
First, remember that floating point and integers enjoy hardware
support. Now, pretend you are you are a VBA6 manager tasked with
implementing a scaled integer type with a precision of 38 digits. I
think you would too come to the conclusion that the new Decimal type
would best be implemented as a reference type using multiple integers
i.e. the integers would not be required to exists in contiguous memory
addresses.
inability to
use them directly in VBA
So if you understand why Decimal was best implemented as a reference
type, why is it such a big deal that is a Variant subtype, rather than
an intrinsic type i.e. what practical difference does it make?
Who says a Jet type need to map directly to an intrinsic VBA value type
anyhow? VARCHAR, MEMO, OLEOBJECT, MEMO and BINARY are distinct Jet data
types but they all map to the VBA String intrinsic type. TINYINT maps
to Long but SMALLINT maps to Integer - explain that one <g>. The best
example is CHAR(N): it map directly to the intrinsic value data type
String * N, yet hardly anyone here uses either the Jet type or the VBA
type.
I trust you understand my suspicion that you are merely throwing up a
smoke screen.
the inability to
use them directly in VBA and the inability to use them to sort (see:
http://allenbrowne.com/bug-08.html) ... I typically would not choose that
datatype, since it seems partially implemented, which seems to be the same
sentiment that Allen Browne has.
With respect, I think you haven't done any research. I get the
impression you read Allen Browne's biased attempt to discredit the
DECIMAL type, which was something to do with the lack of support in
DAO, I guess (but really no one, even Allen, can remember because he
only spent an hour on it half a decade ago and has not got around to
revisiting it since) and took the ideas as your own.
If you link to the article and say things like 'inability to use them
to sort', can I take it you are prepared to defend those points? For
example:
· How can something with a predictable (albeit wrong) sort order be
rationally considered 'wildly inaccurate'?
· Why say 'Nulls and zeros sort unpredictably' when they are entirely
predicable and consistent e.g. can you post some code where the DECIMAL
type violates Jet's strict collation that guarantees NULLs are sorted
to the end of the resultset?
· Are you aware that a sort is only wrong (but still predictable) in
very limited circumstances i.e. when the order is descending AND the
resultsets includes negative numbers AND the sort is performed by the
engine (being more of a convenience rather than a show stopper e.g. use
the recordset's Sort method)?
[CURRENCY] is a FIXED POINT
It is
considered a HIGHLY accurate datatype since it is not prone to representation
errors that are inherent in FLOATING POINT numbers
Also, when doing math with
FIXED POINT math is faster.
Finally, my usual closing question. You have convinced us of the need
for a fixed point type, so what do you do when the client demands five
decimal places? Use CURRENCY and multiply by ten? Roll your own scaled
integer type with a full set of (fast) mathematic functions?
Jamie.