[AccessD] Rounding Problem?

Charlotte Foust charlotte.foust at gmail.com
Fri Oct 19 14:17:57 CDT 2012


It works because with other numeric formats, you're dealing with precision
issues.  This has been around forever and demonstrated in plenty of
articles.  If you are dealing with sales, prices, or anything else related
to currency, use a currency datatype for the field.  You can format the
output however you like and still not cope with fractional values way out
to the right of the decimal place.

Charlotte

On Fri, Oct 19, 2012 at 11:47 AM, Rocky Smolin <rockysmolin at bchacc.com>wrote:

> Lambert:
>
> That worked!  Thanks.  Hate to make changes to the back end since I have a
> lot of these databases out there to support.  But since no one up to now
> wanted to see more than 2-3 decimal places in the PO I may not need to
> update everybody.  At least I'll know what to do if the situation comes up.
>
>
> Don't think I'll have the problem in N.A and Europe - this guy's in
> Malaysia.
>
> Thanks
>
> Rocky
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
> Sent: Friday, October 19, 2012 11:34 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Rounding Problem?
>
> Have you tried making the field in the table Currency?
>
> Lambert
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
> Sent: Friday, October 19, 2012 2:32 PM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Rounding Problem?
>
> Single.  I changed it to Double to see if that made a difference but it did
> not.
>
> Now I'm thinking of a major kludge where I take the number and multiply by
> 10 to the power of the number of decimal places, add .5, take the FIX() and
> divide back.  Really would hate to go that route.  There's gotta be an
> answer here somewhere.
>
> TIA
>
> Rocky
>
>
> R
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
> Sent: Friday, October 19, 2012 11:21 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Rounding Problem?
>
> What's the data type of the underlying field in your table?
>
> Lambert
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
> Sent: Friday, October 19, 2012 2:16 PM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Rounding Problem?
>
> However, Gustav, I do see one line item which displayed 3000 1.3000
> 3900.0000 when formatted Standard but when formatted Currency displays 3000
> 1.3000 3899.9998.
>
> This is the same part number as the line before it which displays 3500
> 1.3000 4550.0000 correctly whether formatted Currency or Standard.
>
> Any clues there?
>
> TIA
>
> Rocky
>
>
> -----Original Message-----
> From: Rocky Smolin [mailto:rockysmolin at bchacc.com]
> Sent: Friday, October 19, 2012 11:07 AM
> To: 'Access Developers discussion and problem solving'
> Subject: RE: [AccessD] Rounding Problem?
>
> Could it be that simple?  Wait...let me try...rats..no cigar.  The sub
> total
> still comes out 14,559.9998.
>
> And if I use Currency format it shows the $ which I need to not see as the
> app supports multiple currencies and there's a user preference for their
> currency symbol.  Which is why I went with standard.
>
> Any other ideas?  I'm stumped.
>
> Thanks
>
> Rocky
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
> Sent: Friday, October 19, 2012 10:44 AM
> To: accessd at databaseadvisors.com
> Subject: Re: [AccessD] Rounding Problem?
>
> Hi Rocky
>
> That is most likely because you are not using data type Currency.
>
> If I do that, the sum runs to 14560.0000
>
> /gustav
>
>
> >>> rockysmolin at bchacc.com 19-10-12 19:31 >>>
> Dear List:
>
> I have an app in which I allow the user to set a preference for the number
> of decimal places they want to display in currency fields.
>
> In the purchasing module this works well for 1, 2, or 3 decimal places.
>  But
> I have a user who sent me a database where he has selected to display 4
> decimal places (God knows why) and a PO with 6 line items.  The Quantity
> Ordered, Unit Price, and Extension are as follows:
>
> 3500 1.3000 4550.0000
> 3500 1.3000 4550.0000
> 3000 1.3000 3900.0000
> 2000 0.2600   520.0000
> 2000 0.2600   520.0000
> 2000 0.2600   520.0000
>
> The sub-total should add up to 14560 and with 2, or 3 decimal places it
> does.
>
> But if I go to 4 as shown then the sub total (Control Source:
> =Sum([fldPODUnitCost]*[fldPODQuantityOrdered]) )shows as 14,559.9998.  One
> or more of those lines apparently does not have an exact decimal equivalent
> in binary but they all display correctly in the detail.
>
> Both text boxes are Format Standard.
>
> Any clue what the solution is?
>
> MTIA
>
> Rocky Smolin
> Beach Access Software
> 858-259-4334
> www.bchacc.com <http://www.bchacc.com/> www.e-z-mrp.com
> <http://www.e-z-mrp.com/>
> Skype: rocky.smolin
>
>
> --
> 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
>
> --
> 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
>
> --
> 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
>


More information about the AccessD mailing list