Re: Adding function is being dumb

From: Ken Snell [MVP] (kthsneisllis9_at_ncoomcastt.renaetl)
Date: 03/03/05


Date: Thu, 3 Mar 2005 10:41:19 -0500

Yes, Double might cause a bit of rounding, though significantly less than
using Single (as I've found out the hard way :-( in an application).
Currency could work as well and would also greatly reduce rounding.

"Roger Carlson" <NO-Rog3erc-SPAM@hotmail.com> wrote in message
news:ub8oTw$HFHA.3588@TK2MSFTNGP14.phx.gbl...
> As I assumed. I only piped in because the field names led me to believe
> they were integer.
>
> However, another thought just occurred to me. Isn't it true that storing
> integer values in Double-precision variables and then doing math on them
> sometimes introduces rounding errors? I can't find my source, but the
> solution (as I recall) was to use Currency instead. Does this ring a bell
> with you?
>
> --
> --Roger Carlson
> Access Database Samples: www.rogersaccesslibrary.com
> Want answers to your Access questions in your Email?
> Free subscription:
> http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
>
>
>
> "Ken Snell [MVP]" <kthsneisllis9@ncoomcastt.renaetl> wrote in message
> news:O5qrmU2HFHA.2564@tk2msftngp13.phx.gbl...
>> Agreed for an integer number ... in my post, I didn't want to assume that
>> the number was a whole number and then have an additional post about
>> truncation occurring.
>>
>> < g >
>>
>> --
>>
>> Ken Snell
>> <MS ACCESS MVP>
>>
>>
>>
>> "Roger Carlson" <NO-Rog3erc-SPAM@hotmail.com> wrote in message
>> news:uyqwp91HFHA.1392@TK2MSFTNGP10.phx.gbl...
>> > If the fields hold integer values, I'd recommend using CLng instead of
>> > CDbl.
>> >
>> > --
>> > --Roger Carlson
>> > Access Database Samples: www.rogersaccesslibrary.com
>> > Want answers to your Access questions in your Email?
>> > Free subscription:
>> > http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
>> >
>> >
>> > "Ken Snell [MVP]" <kthsneisllis9@ncoomcastt.renaetl> wrote in message
>> > news:OICc7w0HFHA.156@TK2MSFTNGP10.phx.gbl...
>> >> Sounds as if the query thinks the Apr On Hand and Apr Ordered Amount
>> > values
>> >> are strings, not numbers. I take it that these are parameters that you
>> > enter
>> >> when you run the query?
>> >>
>> >> Try this (using CDbl function to change the inputted values into
>> >> numbers):
>> >> EndMonth: CDbl([Apr On Hand])+CDbl([Apr Ordered Amount])
>> >>
>> >>
>> >> --
>> >>
>> >> Ken Snell
>> >> <MS ACCESS MVP>
>> >>
>> >> "nbuwalda" <nbuwalda@discussions.microsoft.com> wrote in message
>> >> news:B6CB069A-F042-4BE7-B802-5139054E9C1A@microsoft.com...
>> >> >I have to fields that data is inputted to and want to add them up and
>> >> >put
>> >> >the
>> >> > output in another field. My equation is as follows:
>> >> >
>> >> > EndMonth: [Apr On Hand]+[Apr Ordered Amount]
>> >> >
>> >> > I have my output field set to EndMonth but when I input values into
> the
>> >> > Apr
>> >> > On Hand and Apr Ordered Amount fields it doesnt add them, it
>> >> > combines
>> >> > them.
>> >> > Say I put a 2 in AOH and a 5 in AOA, instead of giving me seven it
>> >> > gives
>> >> > me
>> >> > 25. If I subtract, multiply or divide it works ok. Is there a
>> > different
>> >> > symbol I need to put in place of the +?
>> >>
>> >>
>> >
>> >
>>
>>
>
>



Relevant Pages

  • Re: best practices.rounding
    ... And, if using Currency, whether for actual currency or non-currency situations, ... greater precision at the individual transaction level the cumulative rounding ... can differ from the sum of the individually rounded amounts. ...
    (microsoft.public.access.gettingstarted)
  • Re: Anyone had different results between Access calculations and E
    ... professionally and am aware of the rounding issues. ... my calculations and try to have closer control over the calculating field ... Dim MyNumber As Single ... If that is the case, then use a currency field, NOT ...
    (microsoft.public.access.reports)
  • Re: Pennies problem
    ... Client complains that there is sometimes difference in pennies in tax ... Dim Tax as Currency ... Then we must consider rounding. ...
    (comp.databases.ms-access)
  • RE: best practices.rounding
    ... discrepancy with manual addition or subtraction when a Currency data type is ... greater precision at the individual transaction level the cumulative rounding ... can differ from the sum of the individually rounded amounts. ...
    (microsoft.public.access.gettingstarted)
  • Re: Sum not totalling correctly
    ... At what point do I need to perform the rounding? ... > The Currency data type stores the value to 4 decimal places, ... Create a query into this table. ... >>> where Amount is the name of the Currency field you are trying to Sum. ...
    (microsoft.public.access.forms)