Sum Calculation Problem

  • Thread starter Thread starter Deb
  • Start date Start date
D

Deb

Using Access 2000. Have a subform that is based on a query with the fields
FamMemID, TrainingYr, OGTrainHrType, OGTrainHrs. The data displayed on the
subform is based on the FamMemID on the parent form and the year selected on
another subform. The detail section of the subform contain the fields
OGTrainHrType and OGTrainHrs. What I want is to calculate the total
OGTrainHrs. In the form footer I have a text box with the control source
=Sum(OGTrainHrs). Both the OGTrainHrs field and the sum are set to standard
format, 2 decimal places. I am getting a sum... but it's not always
displaying the digits to the right of the decimal point, ie. 1.50+1.50=3.00
but 1.50+1.50+1.50=4.00 instead of 4.50. Even if there is only one value in
the detail section, ie 6.50 the sum field displays 6.00. Does anyone have
any idea what would cause this and how I can get it to calculate/display
correctly? Thanks, Deb
 
Using Access 2000. Have a subform that is based on a query with the fields
FamMemID, TrainingYr, OGTrainHrType, OGTrainHrs. The data displayed on the
subform is based on the FamMemID on the parent form and the year selected on
another subform. The detail section of the subform contain the fields
OGTrainHrType and OGTrainHrs. What I want is to calculate the total
OGTrainHrs. In the form footer I have a text box with the control source
=Sum(OGTrainHrs). Both the OGTrainHrs field and the sum are set to standard
format, 2 decimal places. I am getting a sum... but it's not always
displaying the digits to the right of the decimal point, ie. 1.50+1.50=3.00
but 1.50+1.50+1.50=4.00 instead of 4.50. Even if there is only one value in
the detail section, ie 6.50 the sum field displays 6.00. Does anyone have
any idea what would cause this and how I can get it to calculate/display
correctly? Thanks, Deb

The default Number datatype is Long Integer - and integers are, by
definition, whole numbers. Is [OGTrainHrs] a Long Integer? If so,
change its datatype to Number... Float or to Currency.
 
The field in the underlying table was set to number as data type with
decimal as the format b/c that format is supposed to be able to handle up to
28 points to the right of the decimal. Went ahead and changed the data type
to currency and the format to standard so it doesn't display the $ and it
worked! Thanks

John Vinson said:
Using Access 2000. Have a subform that is based on a query with the fields
FamMemID, TrainingYr, OGTrainHrType, OGTrainHrs. The data displayed on the
subform is based on the FamMemID on the parent form and the year selected on
another subform. The detail section of the subform contain the fields
OGTrainHrType and OGTrainHrs. What I want is to calculate the total
OGTrainHrs. In the form footer I have a text box with the control source
=Sum(OGTrainHrs). Both the OGTrainHrs field and the sum are set to standard
format, 2 decimal places. I am getting a sum... but it's not always
displaying the digits to the right of the decimal point, ie. 1.50+1.50=3.00
but 1.50+1.50+1.50=4.00 instead of 4.50. Even if there is only one value in
the detail section, ie 6.50 the sum field displays 6.00. Does anyone have
any idea what would cause this and how I can get it to calculate/display
correctly? Thanks, Deb

The default Number datatype is Long Integer - and integers are, by
definition, whole numbers. Is [OGTrainHrs] a Long Integer? If so,
change its datatype to Number... Float or to Currency.
 
The field in the underlying table was set to number as data type with
decimal as the format b/c that format is supposed to be able to handle up to
28 points to the right of the decimal. Went ahead and changed the data type
to currency and the format to standard so it doesn't display the $ and it
worked! Thanks

The Decimal datatype has just been recently added to Access, and I've
heard a LOT of complaints about it not working correctly! Glad that
Currency worked for you.
 
Back
Top