adding fields in query

  • Thread starter Thread starter janelgirl
  • Start date Start date
J

janelgirl

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
 
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
 
Thank you so much!! They were set as TEXT fields, and once I adjusted that,
it added correctly. This really helped me from pulling out the remainder of
my hair! Thanks again.
 
Back
Top