onedaywhen said:
This all sounds a bit strange to me.
It might sound strange, but it is the norm!! It is what MOST developers in
ms-access use. If you can find evidence to counter this fact, then I am all
ears. The only reason why it sounds strange to you is because you have not
experienced with the environment. The NORM is to use currency.
The OP asks for 'decimal, two decimal places, no bankers rounding' yet
you say they *must* use CURRENCY with four decimal places and bankers
rounding...?
Well, ok then "must" use is a harsh word. Geesh!! Sure, lets not get in to a
fight on semantics. Lets just change "must use" to it is a good idea, and
reasonable intelligently access developers use currency. After all, we are
trying to be practical here. Don't you want to be practical here?
To clarify the use of "must" was in comparison to floating types (eg: you
must use a integer type - even scaled decimals, or currency, or
whatever..but MUST NOT use floating types, or you WILL get rounding) -- but,
really..not a big deal.
Are there any practical consequences of Decimal not being an intrinsic
type?
Yes, there are!!
Why have any data typing at all? You mean that the whole computing industry
should throw out data typing? Wow, that is a amazing point on your part.
Cleary, you are not suggesting that. However, you ARE asking why have data
typing? If I have to stand here and explain why data typing is useful, then
you have a problem. Using a intrinsic (supported) data type is FAR
preferable WHEN it makes sense to do so! Now you come along and ask why
should we using data types that are supported by a given development
language? You mean you don't think there is any advantage to using a data
type that is supported by given language?
When appropriate, data typing is good. We have data typing so our compiler
and code can more specially define the problem at hand. I mean, you can
often use one data type in place of another, but WHY NOT USE a good defined
and appropriate data type for the problem at hand? This is all about WHAT IS
A GOOD RECOMMENDATION. We are not having discussion about what is POSSIBLE,
but we are MOST certainly talking about what is a good recommended practice
by REASONABLE people!
Before you say that variants are inefficient, consider that fixed
point types lack the *hardware* support enjoyed by integers and
floating point.
I did not make the claim that they are inefficient. My point is that it is
PREFERRED to use a data type that can be defined in code. Really, not much
more to say, unless you don't believe in data typing at all? What is your
point here? (my point is that data typing can be a help WHEN it is
appropriate, nothing more, nothing less). Development platforms have data
typing because it is usually a good idea. What are you disagreeing with
here?
And who says a native Jet data type must be mirrored by an intrinsic
VBA type?
Again,. who said that? Again, MUST is a harsh word. Why do you have to
polarize this issue this way? A good choice, or a choice by a reasonable
intelligent person is most certainly my recommending here.
If you are saying that it requires a VBA intrinsic value type for a Jet
4.0 to be adopted in ms-access land, what about NCHAR(n)? It maps to
VBA's String * n type but I don't see either used too much.
No, not at alll. I am not saying must. However, I am certanly saying it is
nice to be able to work with a supported data type.
'ms-access' means many things to many people. The only version I have
installed right now is Access 12 beta 1. When I create a new table and
select 'Number' for data type I am by default given field size =
Decimal, with options for Precision and Scale. I'm not sure what this
means but it certainly looks like built in support for Decimal to me.
There may be support in the new version ms-access, but that is not the case
RIGHT NOW. You can't give "general" accepted advice to ms-access developer
community based on a product that IS NOT EVEN OUT!! This is no a big issue
here, but we are just trying to give reasonable advice.
If over time support for decimal data types improves, then I have ZERO
problems accepting the use of decimal data over currency types in ms-access.
As it stands right now, using decimal types is NOT normally done. What more
needs to be said? Don't ask me, go ask the community at large and see what
feedback you get...
Look, you *can* use decimal data types. However, for MOST CASES you are
better off to use currency. You have NOT made the case that using decimal
data types for storing data is a better choice then that of currency GIVEN
THE CURRENT develpoment landscape called ms-access.
As for Allen Browne's old chestnuts (yawn):
The 'Invalid Argument Error When You Export Data to a Text File'
problem can be worked around using a different (better) export approach
e.g. embedding an odbc connection a query:
SELECT decimal_col
INTO [TEXT;DATABASE=C:\;].[MyExport#txt]
FROM TestDecimal;
The above is still a work around. Is still something that end users would
have to be aware of. And WORSE, users can not use the standard interface
tools. If you are telling me there is workarounds...then fine. I just
telling you that you have some problems with the standard interface, and you
can avoid those problems by avoiding the use of decimal types.
the results are predicable rather than
'wildly inaccurate' as claimed and the workaround is simple and
reasonable (e.g. do the sorting in the recordset)
Sorting in a reocrdset is of NO use when running a reprot. It is still a
UN-EXPECTED got-ya that is likey to bite any user of the product.
and possibly
beneficial (e.g. avoiding proprietary SQL constructs, client side
sorting more efficient than server side, etc).
Well, lets not get too funny here!! We don't have a client to server setup,
we are talking about a JET based system, so it is ALWAYS client side!!
Yes, what you missed is that devleoper community as a whole does not agree
with you...
I conclude:
- the VBA type issue etc is a bit of a red herring;
Well, it certainly is NOT a huge deal!! However, it is NICE to use something
that is supported. It is not a huge deal, or the end of the world. However,
we are talking about *reasonable* choices here.
One last thing that is puzzling me, Albert. You've convinced us that
double float is unacceptable, so what do you recommend when the client
requires five decimal places? Multiply by 10 and store as CURRENCY?
If you NEED more then what currency offers, then you have to make a design
decision. However, in THE ABOVE EXAMPLE we DID NOT NEED more then what
currency officers.
And, if we did need more then 4 decimal places, then sure, the advantages of
decimal type would come into play. That is no different then asking what do
we do when we need to use a string!! Well, then use a string!! Again, why is
that such a problem with you? If you want to re-define the problem, and them
come back to me and tell me that the advice given changes? Well, ggessh...no
kidding Sherlock!! I am at a complete and utter loss here as to why you
would not think re-defining the problem would case my advice not to change?
And, as for scaling by 10, or 100? Well, IBM's U2, jBase, Rainging Data
(pick) and Advanced Revelation all in fact does EXACTLY THAT!!! So, yes,
that is a possible, and when you look at industry vendors (IBM, jBase, pick,
AREV), that is exactly what they do!
What did you do in development platforms when you don't have scaled decimal
numbers? Having written payroll applications from scratch in Pascal, I can
assure you that I am well versed on what works, and what does not. It would
seem that IBM, jBase, Pick, AREV all agree with my approach. I am not
exactly alone in this view here!! When you write on these systems, your code
has to take into account that values are normally stored as strings, and
with NO decimal places. (your code has to assume the data is scaled).
But, again, if ones needs more then 4 decimal places, then using something
that allows more then 4 decimal places makes sense! (what else would one
conclude here? ). Why is that a problem or a issue? You seem to be taking
greats lengths to polarize my advice. My advice applies to the original
posters question. I don't think using decimal data type is a requirement
here, nor is a advantage, and nor is it supported "well".
It is not question of "must", but what is a reasonable decision for a given
situation and information at hand. If that situation changes, then obviously
the advice given will change also. Why would it not?.
I just don't see the problem here at all....