Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2001
    Location
    UK
    Posts
    24

    Unanswered: Automatically calculated field contents

    I have two fields that take their values from other fields. Currently the calculations are done in an Excel spreadsheet.

    I believe it can be done in Access but do not have the Access knowledge to do it.

    I want to add together the value of the fields from all specified records (would have to be pulled out using a query). Then a calculation done with the sum, then the answer be put in a field of a record in another table.

    Anyone?

  2. #2
    Join Date
    Dec 2001
    Location
    Birmingham, Alabama
    Posts
    12
    You should not store calculated results in your table. This result becomes "Static" and will not be correct if any values the result is based on is altered. Your result should be calculated "Dynamically" when needed so you can be absolutely sure that the result is correct at the time of execution.

    HTH
    RDH
    Last edited by R. Hicks; 12-19-01 at 15:03.

  3. #3
    Join Date
    Dec 2001
    Posts
    79
    Agreed.

    Here's an example:

    select sum(unitprice) from [order details] where productid = 1;

    You can use this query at any time to get a sum of unitprice. You can also use DSum to return this value:

    DSum("unitprice", "[order details]", "productid = 1")

    Hope this helps
    Peter De Baets
    Peter's Software - Microsoft Access Tools for Developers
    http://www.peterssoftware.com

  4. #4
    Join Date
    Nov 2001
    Location
    UK
    Posts
    24
    Thank you for your replies. The daft thing is I already knew what you said but I just wasn't thinking! lol

    Thank you

Posting Permissions

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