Results 1 to 4 of 4

Thread: Calculations

  1. #1
    Join Date
    Sep 2002
    Posts
    79

    Unanswered: Calculations

    I have three fields in a table named: “amount_1”, “amount_2” and “total”.

    How can I get the sum of “amount_1” and “amount _2” in “total”?

    I would like for this calculation to be done in a query, not form.

    Any help is appreciated.

  2. #2
    Join Date
    Sep 2002
    Location
    Land of OZ
    Posts
    173

    Re: Calculations

    Originally posted by alex8111
    I have three fields in a table named: “amount_1”, “amount_2” and “total”.

    How can I get the sum of “amount_1” and “amount _2” in “total”?

    I would like for this calculation to be done in a query, not form.

    Any help is appreciated.

    Normalisation would say that you would never have the total field in the table. You would generate the total field in the query. Here is the SQL to generate a new field called total just in the query.

    SELECT [amount1]+[amount2] AS Total
    FROM Table1


    If however you need to keep the total field in the table, use an update query. Here is the sql for it.

    UPDATE Table1 SET Table1.total = [amount1]+[amount2]

    Remember, whenever you amount1 or amount2 change, the query will have to be run.

    Hope this helps ...
    Mona
    ________________________________
    Life is too short to be sane or sensible. Weird people rule and normal people suck

  3. #3
    Join Date
    Sep 2002
    Posts
    79
    I dont know much about SQL so when i tired to do what you said, it did not work.

    Is there a simple way to just add two fields together and have the result in a third field? I do need it in a table or query.


    Also, i know how to do a mail merge with MS word, but is there a way to do that with Excel?

  4. #4
    Join Date
    Sep 2002
    Location
    Land of OZ
    Posts
    173
    Originally posted by alex8111
    I dont know much about SQL so when i tired to do what you said, it did not work.

    Is there a simple way to just add two fields together and have the result in a third field? I do need it in a table or query.


    Also, i know how to do a mail merge with MS word, but is there a way to do that with Excel?
    Please see attached a database. There are tow tables, one contains a total colum, the other does not.

    For each table, I have created a query.

    For the table with the total column, everytime amount1 or amout2 are changed, the query must be run to update the total column in the table.

    However for the table without the total column, everytime you open the query, the result of the total is upadtes. You can then use this query as the basis for a report or form.

    In regards to a mail merge in Excel, you can't do that, howvere I believe you can send the data to excel using the the Analyse using Excel option from the menu's.

    I think the menu is Tools, Office Links, Analyse It Using MS Excel

    If I can be of any other help, let me know.
    Attached Files Attached Files
    Mona
    ________________________________
    Life is too short to be sane or sensible. Weird people rule and normal people suck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •