Number calculation longer than field allows?

L

laralea

I am doing a simple sum query, but I think the sum may be longer than what
the field allows; I am getting something like 8.41641512552E+11. There are
144000 records in the database and the field that I am trying to sum has up
to 12 digits in each record. These are simple numbers - no currency.
 
D

Douglas J. Steele

What's the data type of the field? If it's a Long Integer, then your
suspicion is probably correct.

You may have to convert it to a Double or Single in your query (using CDbl
or CSng) before summing.
 
M

Marshall Barton

laralea said:
I am doing a simple sum query, but I think the sum may be longer than what
the field allows; I am getting something like 8.41641512552E+11. There are
144000 records in the database and the field that I am trying to sum has up
to 12 digits in each record. These are simple numbers - no currency.


If the field can contain 12 digit numbers, then the data
type must be Double or Text. If the field is type Double,
then I think you are probably(?) OK and the answer you got
is accurate (just format it as you want to see it).

If the field is type Text, then I think you may need to use
this kind of expression to sum it:
CStr(Sum(CDec(thefield)))
 
Top