Query Sum Function Decimal Precision

G

Guest

I have the following query:

SELECT ProjectTime.ProjectTimeProjectTaskID,
Sum(ProjectTime.ProjectTimeActualHours) AS SumOfProjectTimeActualHours
FROM ProjectTime
GROUP BY ProjectTime.ProjectTimeProjectTaskID;

ActualHours is defined as
Field Size = Single
Format = Fixed
Decimal Places = 1

I enter one record with .4 keyed into ActualHours and when I run the sum
query I get an answer of 0.400000005960464

I know that I can round it. But why is the sum not returned as .4?
 
G

Guest

Not only do you set the field definition but you need to set the display
format in the query, form, and report.
 
J

Jamie Collins

S.Clark said:
When Microsoft Access Math Doesn't Add Up
By Luke Chung, President
FMS, Inc.

http://www.fmsinc.com/tpapers/math/index.html

I think that article should be titled, 'When VBA Math Doesn't Add Up'.
The examples do not held true for Jet 4.0 SQL e.g.

SELECT 100.8 - 100.7

correctly returns 0.1.

Accordingly, perhaps the OP should either use the DECIMAL data type or
switch granularity from decimal hours to integer minutes.

Jamie.

--
 

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