Adding Text Fields

  • Thread starter Thread starter Jermaine Cross
  • Start date Start date
J

Jermaine Cross

I am trying to add to text fields in a form it keeps
combining the two fields. Like add field 1 and 2 instead
of giving me 3 it gives me 12.
 
ACCESS will not convert your text-formatted numbers to a number in order to
use the "+" operator. For text strings, + also concatenates the two strings.
It differs from & operator in that & does not proprogate Null values through
the operation, while + does.

For example:
Null & "Ken" produces "Ken"
Null + "Ken" produces Null

To add numbers that are text-formatted, use the Val function to convert them
to numbers:

Val([Field1]) + Val([Field2])

Alternatively, you also can use other functions (CInt for integer
conversion, CLng for long integer conversion, CSng for single conversion,
CDbl for double conversion, CCur for currency conversion, etc.).
 
Back
Top