Add totals in two fields (1 Viewer)

Dave Titan

Registered User.
Local time
Today, 23:12
Joined
Jan 1, 2002
Messages
69
I think this should be easy.......

I've two fields with multible records.

In each field a number is put in.

I'd like a third field to add these numbers for a total.

Can someone lay this out in laymans?

Thanks
 

ColinEssex

Old registered user
Local time
Today, 23:12
Joined
Feb 22, 2002
Messages
9,118
Hi

It's good practice not to have totals of 2 fields in tables, this is because the values may change and the total won't and its also a waste of space.

The solution is to do the totals in a query, report or form so that the total is recalculated fresh each time. Whichever way you choose, the syntax is the same.

[Field1] +[Field2]


Hope this helps

Col
 

Dave Titan

Registered User.
Local time
Today, 23:12
Joined
Jan 1, 2002
Messages
69
Thanks, However whenever I try this in a Form using an Expression the two fields [Males 8-11] + [Males 12-15] just place the numbers side by side like:

Males 8-11 = 5
Males 12-15= 5
Total Males = 55

It does not add them up together??
 

ColinEssex

Old registered user
Local time
Today, 23:12
Joined
Feb 22, 2002
Messages
9,118
Hi

I just tried this on a form just to make sure and it works fine

=[Field1] + [Field2]

enter the above in the control source of an unbound textBox

Col
 

Dave Titan

Registered User.
Local time
Today, 23:12
Joined
Jan 1, 2002
Messages
69
Right, strange thing afoot.

I tried that again, and it didn't work. But I then made a new DB, and it did?!!

I don't understand why it would work in one but not another??

Ok yes I do. Two fields were in memo not number........

Listen thanks for the help I'll be able to add a few things up now

Cheers
 
Last edited:

Dave Titan

Registered User.
Local time
Today, 23:12
Joined
Jan 1, 2002
Messages
69
Everything seems to be working. But any ideas how to get two totals (made by unbound text boxes) into an other totals box.

so I've two added up boxes "male" + "female". I'd like to add them together but because they're text boxes it doesn't seem to work???????

Just figured it, change the label caption!
 
Last edited:

Pat Hartman

Super Moderator
Staff member
Local time
Today, 18:12
Joined
Feb 19, 2002
Messages
43,374
The plus (+) operator serves a dual function in VBA. It is used as a secondary concatenation operator (the primary is the ampersand (&)) and also to add two numbers. When used with fields defined as text the result will be the two strings, one after the other. When used with two numeric fields, the result will be the sum of the two numbers.
 

Users who are viewing this thread

Top Bottom