View Full Version : Getting a Total from 4 textboxes.
mcleyn
May 20, 2010, 08:51 AM
Hi there,
I am trying to produce a total sum text box from four text boxes inside a form.
I have tried writing the following macro for total sum text box but it does not work:
=Sum([textboxName1])+([textboxName2])+([textboxName3])+([textboxName4])
What is an easier way of doing this?
ScottGem
May 20, 2010, 09:02 AM
First that's not a macro but an expression. And its an incorrect expression. You are saying to return a sum of one control and adding the other three.
You should have a textbox control with a Controlsource of:
=[textboxName1]+[textboxName2]+[textboxName3]+[textboxName4]
That should do the job for you.
mcleyn
May 20, 2010, 10:48 AM
First that's not a macro but an expression. And its an incorrect expression. You are saying to return a sum of one control and adding the other three.
You should have a textbox control with a Controlsource of:
=[textboxName1]+[textboxName2]+[textboxName3]+[textboxName4]
That should do the job for you.
Ok wonderful. That works perfectly. Is it possible to have this textbox that holds the answer of the totals to have another control source that puts this answer back into my table?
ScottGem
May 20, 2010, 03:25 PM
This is a common mistake made by people new to database design. As a general rule we do NOT store calculated values. Such values can be displayed using the same expression wherever you need to display it.
mcleyn
May 21, 2010, 05:50 AM
This is a common mistake made by people new to database design. As a general rule we do NOT store calculated values. Such values can be displayed using the same expression wherever you need to display it.
Ok thank you very much for your help!