A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Variable/Adaptive Numeric Format



 
 
Thread Tools Display Modes
  #1  
Old January 7th, 2010, 11:20 PM posted to microsoft.public.access.reports
JASelep[_2_]
external usenet poster
 
Posts: 5
Default 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  
Old January 8th, 2010, 02:23 AM posted to microsoft.public.access.reports
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default 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  
Old January 8th, 2010, 02:06 PM posted to microsoft.public.access.reports
Dale Fye
external usenet poster
 
Posts: 2,651
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:45 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.