[AccessD] Decimal Data Type

Darryl Collins Darryl.Collins at coles.com.au
Thu May 15 19:55:25 CDT 2008


Amen!

although it seems microsoft is not the only one getting the sales... ;)

MenuExcel
http://www.addintools.com/english/menuexcel/

Tooolbar Toggle
http://www.toolbartoggle.com

XL Menu 2003
http://in.geocities.com/shahshaileshs/

hehehehe...



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of jwcolby
Sent: Thursday, 15 May 2008 11:53 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Decimal Data Type


Bug fixes don't sell software.  Ribbon bars sell software.

John W. Colby
www.ColbyConsulting.com


William Hindman wrote:
> ...MS knows about the problems and is simply unable or unwilling to fix them 
> over multiple versions ...instead of fixes to well known bugs, we get the 
> "ribbon" ...something everyone demanded ...on every wish list, eh :(
> 
> ...google "access bugs decimal" ...Allan Browne has a particularly good 
> breakdown on the topic.
> 
> William
> 
> --------------------------------------------------
> From: "Gustav Brock" <Gustav at cactus.dk>
> Sent: Thursday, May 15, 2008 9:05 AM
> To: <accessd at databaseadvisors.com>
> Subject: Re: [AccessD] Decimal Data Type
> 
>> Hi Tony (iggy?)
>>
>> As for the difference, look up the on-line help for range etc.
>>
>> Why it was added I don't know, but I guess it was to have a data type 
>> compatible with Decimal of SQL Server.
>>
>> I haven't used it myself in a table. William, I think, posted some years 
>> ago some nasty examples on errors which the use of the data type could 
>> cause.
>>
>> In VBA it can be necessary for avoiding bit errors when handling very 
>> large numbers. I use it in our rounding function posted several times.
>>
>> Here is another example: Create the Fibonacci sequence of numbers. If Long 
>> was used only 46 elements could be calculated:
>>
>> <code>
>> Public Function FibonacciSequenceDec( _
>>  ByVal lngElements As Long) _
>>  As Variant
>>
>> ' Build and return array with Fibonacci sequence of numbers.
>> ' Count of elements is determined by lngElements.
>> ' Max. number returned in array:
>> '   50095301248058391139327916261
>> '
>> ' 2004-10-03. Gustav Brock, Cactus Data, CPH.
>>
>>  ' Min. index of sequence per definition.
>>  Const clngIndexMin  As Long = 0
>>  ' Max. possible index of sequence for datatype Decimal.
>>  Const clngIndexMax  As Long = 139
>>
>>  Dim adecSeq()       As Variant
>>  Dim lngIndex        As Long
>>
>>  If lngElements < clngIndexMin Or lngElements > clngIndexMax Then
>>    ' Not a valid input.
>>  Else
>>    ' Build and fill array with the Fibonacci sequence of numbers.
>>    ReDim adecSeq(clngIndexMin To lngElements)
>>    For lngIndex = clngIndexMin To lngElements
>>      If lngIndex < 2 Then
>>        ' Values of the first two elements are 0 and 1 per definition.
>>        adecSeq(lngIndex) = CDec(lngIndex)
>>      Else
>>        ' Value is the sum of the two preceding numbers.
>>        adecSeq(lngIndex) = CDec(adecSeq(lngIndex - 2)) + 
>> CDec(adecSeq(lngIndex - 1))
>>      End If
>> ''      Debug.Print adecSeq(lngIndex);
>>    Next
>>  End If
>>
>>  FibonacciSequenceDec = adecSeq()
>>
>> End Function
>>
>> Public Function FibonacciElementDec( _
>>  ByVal lngElements As Long) _
>>  As Variant
>>
>> ' Returns the value of element lngElements in the
>> ' Fibonacci sequence of numbers.
>> ' Max. number returned:
>> '   50095301248058391139327916261
>> '
>> ' 2004-10-03. Gustav Brock, Cactus Data, CPH.
>>
>>  Const clngIndexMin  As Long = 0
>>  Const clngIndexMax  As Long = 139
>>
>>  Dim decValue        As Variant
>>
>>  If lngElements < clngIndexMin Or lngElements > clngIndexMax Then
>>    ' Not a valid input. Return error.
>>    decValue = CDec(-1)
>>  Else
>>    ' Return last number in sequence in array.
>>    decValue = FibonacciSequenceDec(lngElements)(lngElements)
>>  End If
>>
>>  FibonacciElementDec = decValue
>>
>> End Function
>> </code>
>>
>> /gustav
>>
>>>>> iggy at nanaimo.ark.com 15-05-2008 14:37 >>>
>> Hey Gustav
>> How does Decimal differ from Double or Currency and do you know why it
>> was added as a data type?  As Edward has confirmed when Access does the
>> conversion "you have to hunt through the app and fix things by hand".
>>
>> That said, Decimal should be avoided as data type in tables as it is known 
>> to be buggy. In VBA, however, it can be quite useful.
>>
>> Just out of curiosity (because I don't know what it is supposed to be
>> used for) where would you use it in VBA?
>>
>> Thanks
>>
>>
>> -- 
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>
> 
> 
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

This email and any attachments may contain privileged and confidential information and are intended for the named addressee only. If you have received this e-mail in error, please notify the sender and delete this e-mail immediately. Any confidentiality, privilege or copyright is not waived or lost because this e-mail has been sent to you in error. It is your responsibility to check this e-mail and any attachments for viruses.  No warranty is made that this material is free from computer virus or any other defect or error.  Any loss/damage incurred by using this material is not the sender's responsibility.  The sender's entire liability will be limited to resupplying the material.




More information about the AccessD mailing list