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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|