help with number calculation

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to add numbers in different columns in a query and display the
result in a new column [total score] as follows total score: [cvs]+[cns]
The results that I am getting are as follow 2+2= 22 not 4
How can I change this please?
Many thanks for your help
 
It sounds as if your columns are defined as text.

Try

Val([CVS]) + Val([CNS])

That could still generate errors if either field could not be
interpreted as a number.

If you run into problems then you would need something like
IIF(IsNumeric([CVS]),Val([CVS]),0) + IIF(IsNumeric([CNS]),Val([CNS]),0)


'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
This fields type is probably text, so instead of adding them up as Numeric
fields it connecting them together.

You can either change the field type to Numer, or in the query convert them
to numbers, and using the Nz to replace Null with 0


total score: Val(Nz([cvs],0))+Val(Nz([cns],0))
 
Back
Top