Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Access (https://www.askmehelpdesk.com/forumdisplay.php?f=441)
-   -   Getting a Total from 4 textboxes. (https://www.askmehelpdesk.com/showthread.php?t=471972)

  • May 20, 2010, 08:51 AM
    mcleyn
    Getting a Total from 4 textboxes.
    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?
  • May 20, 2010, 09:02 AM
    ScottGem

    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.
  • May 20, 2010, 10:48 AM
    mcleyn
    Quote:

    Originally Posted by ScottGem View Post
    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?
  • May 20, 2010, 03:25 PM
    ScottGem

    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.
  • May 21, 2010, 05:50 AM
    mcleyn
    Quote:

    Originally Posted by ScottGem View Post
    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!

  • All times are GMT -7. The time now is 10:17 PM.