formatting number as fixed not bahaving as expected

T

Tony Vrolyk

In a Group By query, a number field that contains values that are only one
decimal place is returning a value with 13 decimal places when Summed.

I have a DB that is used to track employee time. The time they enter is
entered as tenths of an hour .1 = 6 min, .2 = 12 min and so on. I use the
format function on the form where time is entered to force the time amount
to be only a single digit past the decimal.
i.e. Me.Hours = format(somenumber, "0.0")
After that the record is saved, referencing the value of the Me.Hours
control which is entered into the field that I am trying to Sum.

In the query I display only the username and hours fields. I Group By
Username and Sum Hours and it returns a value for Sum(Hours) that is 13
decimal places

I have reviewed the data a number of ways to try to find a record that is
more than one decimal place but I can't find any. I changed the formatting
on the field in the table to be 15 decimal places and they all show as a
single decimal. I ran greater then/less then queries, I exported to Excel to
analyze the number and still find not records more then 1 decimal

So assuming the data is all single decimal places why is the query doing
this? Even using one of these...
Sum(Format([Hours],"00.00"))
Sum(Format([Hours],"Fixed"))
....still returns 13 decimal places. That in turn shows up on in the list box
that uses this query as its source.

Thanks for your help
Tony
 
T

Tony Vrolyk

Ok that worked for the final output but why would I get the extra decimal
places in the first place?

Tony


KARL DEWEY said:
You need to sum then format like --
Format(Sum(xxx ---

Or in design view click at the top of the output field to highlight the
column and then right-click and select properties to set the output
format.

Tony Vrolyk said:
In a Group By query, a number field that contains values that are only
one
decimal place is returning a value with 13 decimal places when Summed.

I have a DB that is used to track employee time. The time they enter is
entered as tenths of an hour .1 = 6 min, .2 = 12 min and so on. I use the
format function on the form where time is entered to force the time
amount
to be only a single digit past the decimal.
i.e. Me.Hours = format(somenumber, "0.0")
After that the record is saved, referencing the value of the Me.Hours
control which is entered into the field that I am trying to Sum.

In the query I display only the username and hours fields. I Group By
Username and Sum Hours and it returns a value for Sum(Hours) that is 13
decimal places

I have reviewed the data a number of ways to try to find a record that is
more than one decimal place but I can't find any. I changed the
formatting
on the field in the table to be 15 decimal places and they all show as a
single decimal. I ran greater then/less then queries, I exported to Excel
to
analyze the number and still find not records more then 1 decimal

So assuming the data is all single decimal places why is the query doing
this? Even using one of these...
Sum(Format([Hours],"00.00"))
Sum(Format([Hours],"Fixed"))
....still returns 13 decimal places. That in turn shows up on in the list
box
that uses this query as its source.

Thanks for your help
Tony
 
T

Tony Vrolyk

Thanks for your help!

Tony


KARL DEWEY said:
Numbers (not text) are stored in binary in the computer. They are added
in
binary. Then converted into decimal for viewing. Along the way they lose
precision.
That is why there is Double & Single precision number. Read up on it.

Tony Vrolyk said:
Ok that worked for the final output but why would I get the extra decimal
places in the first place?

Tony


KARL DEWEY said:
You need to sum then format like --
Format(Sum(xxx ---

Or in design view click at the top of the output field to highlight the
column and then right-click and select properties to set the output
format.

:

In a Group By query, a number field that contains values that are only
one
decimal place is returning a value with 13 decimal places when Summed.

I have a DB that is used to track employee time. The time they enter
is
entered as tenths of an hour .1 = 6 min, .2 = 12 min and so on. I use
the
format function on the form where time is entered to force the time
amount
to be only a single digit past the decimal.
i.e. Me.Hours = format(somenumber, "0.0")
After that the record is saved, referencing the value of the Me.Hours
control which is entered into the field that I am trying to Sum.

In the query I display only the username and hours fields. I Group By
Username and Sum Hours and it returns a value for Sum(Hours) that is
13
decimal places

I have reviewed the data a number of ways to try to find a record that
is
more than one decimal place but I can't find any. I changed the
formatting
on the field in the table to be 15 decimal places and they all show as
a
single decimal. I ran greater then/less then queries, I exported to
Excel
to
analyze the number and still find not records more then 1 decimal

So assuming the data is all single decimal places why is the query
doing
this? Even using one of these...
Sum(Format([Hours],"00.00"))
Sum(Format([Hours],"Fixed"))
....still returns 13 decimal places. That in turn shows up on in the
list
box
that uses this query as its source.

Thanks for your help
Tony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top