[AccessD] Decimals Problem

Gustav Brock gustav at cactus.dk
Wed Sep 16 10:04:07 CDT 2015


Hi Rocky

If you don't need the exact value for further calculations, round it permanently to two decimals. I recently posted a link to all my rounding functions.

If you need the value as is, you may consider having an unbound textbox displaying the rounded value. When you update this, update the bound field.

/gustav

-----Oprindelig meddelelse-----
Fra: AccessD [mailto:accessd-bounces at databaseadvisors.com] På vegne af Rocky Smolin
Sendt: 16. september 2015 16:54
Til: 'Access Developers discussion and problem solving' <accessd at databaseadvisors.com>
Emne: [AccessD] Decimals Problem

Dear List:
 
In an app there's a text box bound to a quantity on hand field.  Sometimes there is no exact equivalent in hex of a decimal fraction value.  So instead of showing 150 the box shows 149.998475.  There is a user-specified preference in a table specifying the number of decimal places to display.  
 
Problem 1: If I set this in the property sheet instead of through code in the _Open event, it works.  Setting the .DecimalPlaces property in code does not work in the case of 149.998475.
 
Problem 2: Even if I can get the number to display as 150 by setting the .DecimalPlaces property to zero, when I click into the text box the number changes from 150 to display 149.998475.
 
Problem 3, the user I think will want one or two decimal places to show wherever quantity on hand shows in the app - but not sure.  Maybe they'll buy off on zero places.
 
Any leads on how to solve this greatly appreciated.
 
MTIA
 
Rocky 



More information about the AccessD mailing list