View Single Post
  #2  
Old May 5th, 2010, 12:38 PM posted to microsoft.public.access.gettingstarted
John Spencer
external usenet poster
 
Posts: 7,815
Default adding fields in query

It sounds as if the fields are being treated as if they are TEXT fields.

Try using the Val function or one of the conversion functions (Cdbl) to force
the conversion of the text to a number. Of course this will fail if the fields
are ever null (blank) or contain a non-numeric value.

=CDbl(FieldOne)+CDbl(FieldTwo)+CDbl(FieldThree)

To handle nulls in a field combine the VAL function with the NZ function
Val(Nz(FieldOne,0))


John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

janelgirl wrote:
I am trying to add fields in a query to put into a new field. For example;
FieldOne, FieldTwo, and FieldThree should equal FieldFour. FieldOne has a
value of 1, FieldTwo has a value of 2 and FieldThree has a value of 3. When
I try =FieldOne+FieldTwo+FieldThree in FieldFour with the expression builder,
it does not add them, it just shoves all their values together. Instead of
FieldFour having a value of 6 when I run the query, it gives me a value of
123. I have also tried the "&" instead of "+", and I get the same results.
I have tried changing the Total line to Sum, Group By, Expression, and Count.
the query still does the same thing. Access is fairly new to me, so I am
sure that there is a simple solution that I am overlooking. Any help
provided would be great. TIA