P
(PeteCresswell)
This is a spin off from the thread
"Immediate Window: Annoying Notation?"
It's a *really* big deal to me all-of-a-sudden bc it sounds like
my current SOP might be at variance with good practice.
Lotta years ago (JET 3.something) and for reasons not recollected
I settled on Double as my data type of choice for big numbers
with lots of decimal places.
Now it's sounding like Decimal is the preferred vehicle, but I'm
a little confused - no... make that a *lot* confused. If
Decimal is so "right", how come VBA doesn't support it directly
in the Dim statement?
Decimal seems tb a slam-dunk for tables - where it's an explicit
data type, but for Dim'd values there appear tb issues that I
should resolve before I go and shoot myself in the foot.
Sounds like Decimal can be loaded into a Variant - either with a
simple equate as in "myVariant = !WhatEverDecimal" or by
coercion as in "myVariant = cDec(!WhatEverDecimal".
Is it a no-brainer to dim Variants instead of Doubles?
If so, what about the type checking that is sacrificed?
What about results where a computation operates on both Doubles
Decimals and the result rolls out into a Variant? Guaranteed
Decimal result? Does it matter?
Does anybody actually use all Variants for Dim'd fields where
decimals are necessary and there is no specific need for Double?
If so, do you always load the field by coercion - using cDec() -
or do you just do an equate?
Or do most people Dim Double for big numbers with lots of decimal
places?
"Immediate Window: Annoying Notation?"
It's a *really* big deal to me all-of-a-sudden bc it sounds like
my current SOP might be at variance with good practice.
Lotta years ago (JET 3.something) and for reasons not recollected
I settled on Double as my data type of choice for big numbers
with lots of decimal places.
Now it's sounding like Decimal is the preferred vehicle, but I'm
a little confused - no... make that a *lot* confused. If
Decimal is so "right", how come VBA doesn't support it directly
in the Dim statement?
Decimal seems tb a slam-dunk for tables - where it's an explicit
data type, but for Dim'd values there appear tb issues that I
should resolve before I go and shoot myself in the foot.
Sounds like Decimal can be loaded into a Variant - either with a
simple equate as in "myVariant = !WhatEverDecimal" or by
coercion as in "myVariant = cDec(!WhatEverDecimal".
Is it a no-brainer to dim Variants instead of Doubles?
If so, what about the type checking that is sacrificed?
What about results where a computation operates on both Doubles
Decimals and the result rolls out into a Variant? Guaranteed
Decimal result? Does it matter?
Does anybody actually use all Variants for Dim'd fields where
decimals are necessary and there is no specific need for Double?
If so, do you always load the field by coercion - using cDec() -
or do you just do an equate?
Or do most people Dim Double for big numbers with lots of decimal
places?