adding numbers in each field?...really simple question!

jammy_owen

Registered User.
Local time
Today, 21:36
Joined
Dec 13, 2002
Messages
13
hello. all i want to do is add up two sets of numbers from two fields. i.e add up the information from field 'a', which i can put as 1, and add up with the info from field 'b', for instance 2. the answer i want in this case is 3.
But, for some reason, when i add up these fields with the '+' sign in the middle of my expression it will make the above example equal 12, because it adds the number from field 'b' onto the end of field'a'. i will put the problem in a simple diagram to make this simple question even simpler for you all.

field 'a' field 'b' outcome wanted outcome recieved
1--------2--------------3---------------12
2--------2--------------4---------------22
3--------3--------------6---------------33
etc.

what i did was 'outcome wanted: [field 'a']+[field 'b']' but, like i said, it ends up with the 'outcome recieved' results.

this shouldn't take you guys long to figure it out so a hasty reply would be grateful!!
 
Access is apparently concatenating the digits, as you can see. If these numbers are being stored as numbers in your database table(s), then you can add them up in a query using an expression like this in the field line:
[Field1]+[Field2]

What are the fields actually called? They're not called "Field 'a'" and "Field 'b'" are they? If so, I'd rename them and get rid of the apostrophe characters.
 
=Val([FieldA])+Val([FieldB])
 
yey! thanks mile-o-phile! i told you it was a simple question!
 
Rather than using a bandaid (the Val() function), you should change the data type of the fields to numeric if their contents are supposed to be numeric.
 

Users who are viewing this thread

Back
Top Bottom