Query Sum Function Decimal Precision

  • Thread starter Thread starter Guest
  • Start date Start date
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?
 
Not only do you set the field definition but you need to set the display
format in the query, form, and report.
 
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.

--
 
Back
Top