If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Variable/Adaptive Numeric Format
in Access 2007
I some report fields that are to display quantities and amounts the range of these numbers could be large (100,000 or $345,999) or small (0.375 or $0.0625) is there a way to have the field formatted to adapt to the range of the value being displayed for example if the value has no significant decimals then display the value without decimal places (512.00 becomes 512) or if the value has many decimals limit the display to only 2 decimals (0.63712938 becomes 0.64) -- Jim |
#2
|
|||
|
|||
Variable/Adaptive Numeric Format
How do you propose to explain to Access how to tell that a number "has no
significant decimals"? Unless you can explain it to Access, Access won't be able to handle that. I'm having trouble imagining a simple process that would handle integers, real numbers, and fractional decimals. I suspect it can be done, but you'd probably need to test each value to find out which of the above it was, before handling appropriately. Good luck! Regards Jeff Boyce Microsoft Access MVP -- Disclaimer: This author may have received products and services mentioned in this post. Mention and/or description of a product or service herein does not constitute endorsement thereof. Any code or pseudocode included in this post is offered "as is", with no guarantee as to suitability. You can thank the FTC of the USA for making this disclaimer possible/necessary. "JASelep" wrote in message ... in Access 2007 I some report fields that are to display quantities and amounts the range of these numbers could be large (100,000 or $345,999) or small (0.375 or $0.0625) is there a way to have the field formatted to adapt to the range of the value being displayed for example if the value has no significant decimals then display the value without decimal places (512.00 becomes 512) or if the value has many decimals limit the display to only 2 decimals (0.63712938 becomes 0.64) -- Jim |
#3
|
|||
|
|||
Variable/Adaptive Numeric Format
If you can define the logic for "significant details", then you can use the
Detail sections Format event. Something like: Private Sub Detail_Format if abs(val(NZ(me.txtQuantity, 0)) - int(val(NZ(me.txtQuantity, 0)))) ..005 Then me.txtQuantity.Format = "#" else me.txtQuantity.Format = "#.00" endif End Sub -- ---- HTH Dale "JASelep" wrote: in Access 2007 I some report fields that are to display quantities and amounts the range of these numbers could be large (100,000 or $345,999) or small (0.375 or $0.0625) is there a way to have the field formatted to adapt to the range of the value being displayed for example if the value has no significant decimals then display the value without decimal places (512.00 becomes 512) or if the value has many decimals limit the display to only 2 decimals (0.63712938 becomes 0.64) -- Jim |
Thread Tools | |
Display Modes | |
|
|