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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Limit decimal places without format statement



 
 
Thread Tools Display Modes
  #1  
Old November 4th, 2009, 07:59 PM posted to microsoft.public.access.forms
JohnM77 via AccessMonster.com
external usenet poster
 
Posts: 17
Default Limit decimal places without format statement

I wish for my query to display two decimal places without truncating the
original data. I've accomplished this goal by using the format function in
the query, but this function converts the numeric data to string.
Consequently, programmatically filtering a form (which displays the query)
for numerical ranges fails, due to the values no longer being numeric.

Is there a way to force two decimal places to be displayed without converting
to a non-numeric datatype?

Thanks,
John

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/200911/1

  #2  
Old November 4th, 2009, 08:03 PM posted to microsoft.public.access.forms
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Limit decimal places without format statement

"JohnM77 via AccessMonster.com" u53407@uwe wrote in message
news:9ea037cb1bd22@uwe...
I wish for my query to display two decimal places without truncating the
original data. I've accomplished this goal by using the format function in
the query, but this function converts the numeric data to string.
Consequently, programmatically filtering a form (which displays the query)
for numerical ranges fails, due to the values no longer being numeric.

Is there a way to force two decimal places to be displayed without
converting
to a non-numeric datatype?



How about using the Round() function? It should be available in Access
versions 2000 and after, though I believe it took a service pack to make it
available to queries in Access 2000.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

  #3  
Old November 4th, 2009, 08:34 PM posted to microsoft.public.access.forms
JohnM77 via AccessMonster.com
external usenet poster
 
Posts: 17
Default Limit decimal places without format statement

Thanks for your reply, Dirk. I just tried the ROund function like this,

Plate Length: Round([Length],2)

expecting it to round all Length values to two decimal places. Oddly, the
result is displaying 13 decimal places and is definitely not rounding. One
value, entered as 1.01 is displayed as 1.0999999046326. The field datatype in
the original table is number/single.

Dirk Goldgar wrote:
I wish for my query to display two decimal places without truncating the
original data. I've accomplished this goal by using the format function in

[quoted text clipped - 5 lines]
converting
to a non-numeric datatype?


How about using the Round() function? It should be available in Access
versions 2000 and after, though I believe it took a service pack to make it
available to queries in Access 2000.


--
Message posted via http://www.accessmonster.com

  #4  
Old November 4th, 2009, 08:42 PM posted to microsoft.public.access.forms
JohnM77 via AccessMonster.com
external usenet poster
 
Posts: 17
Default Limit decimal places without format statement

Actual value should have been 1.00999999046326 in previous post.

JohnM77 wrote:
Thanks for your reply, Dirk. I just tried the ROund function like this,

Plate Length: Round([Length],2)

expecting it to round all Length values to two decimal places. Oddly, the
result is displaying 13 decimal places and is definitely not rounding. One
value, entered as 1.01 is displayed as 1.0999999046326. The field datatype in
the original table is number/single.

I wish for my query to display two decimal places without truncating the
original data. I've accomplished this goal by using the format function in

[quoted text clipped - 5 lines]
versions 2000 and after, though I believe it took a service pack to make it
available to queries in Access 2000.


--
Message posted via http://www.accessmonster.com

  #5  
Old November 4th, 2009, 09:12 PM posted to microsoft.public.access.forms
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Limit decimal places without format statement

"JohnM77 via AccessMonster.com" u53407@uwe wrote in message
news:9ea087306c312@uwe...
Thanks for your reply, Dirk. I just tried the ROund function like this,

Plate Length: Round([Length],2)

expecting it to round all Length values to two decimal places. Oddly, the
result is displaying 13 decimal places and is definitely not rounding. One
value, entered as 1.01 is displayed as 1.0999999046326. The field datatype
in
the original table is number/single.



Interesting. When I do this with Doubles, it comes out looking pretty good,
but not with Singles. I suspect the problems have to do with the relative
precisions of the data types.

Try this: forget the Round function, and modify the Format and Decimal
Places properties of the field in the query. In query design view, click on
the field in the grid, then press Alt+Enter or click the toolbar button to
open the property sheet for the field. Set the Format property to "Fixed"
and the Decimal Places property to 2. That should cause the field values to
be displayed by the queries with two decimal places, except when the field
has the datasheet's focus. Does that serve your needs well enough? It
doesn't round the actual value, but causes it to display as rounded.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

  #6  
Old November 4th, 2009, 09:29 PM posted to microsoft.public.access.forms
JohnM77 via AccessMonster.com
external usenet poster
 
Posts: 17
Default Limit decimal places without format statement

Excellent. That did the trick! Thanks for your help. You've helped me before,
too. I truly appreciate your time and effort.

Best regards,
John

Dirk Goldgar wrote:
Thanks for your reply, Dirk. I just tried the ROund function like this,

[quoted text clipped - 5 lines]
in
the original table is number/single.


Interesting. When I do this with Doubles, it comes out looking pretty good,
but not with Singles. I suspect the problems have to do with the relative
precisions of the data types.

Try this: forget the Round function, and modify the Format and Decimal
Places properties of the field in the query. In query design view, click on
the field in the grid, then press Alt+Enter or click the toolbar button to
open the property sheet for the field. Set the Format property to "Fixed"
and the Decimal Places property to 2. That should cause the field values to
be displayed by the queries with two decimal places, except when the field
has the datasheet's focus. Does that serve your needs well enough? It
doesn't round the actual value, but causes it to display as rounded.


--
Message posted via http://www.accessmonster.com

 




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 08:19 PM.


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