Results 1 to 4 of 4
  1. #1
    DB88 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    110

    Help with doing calculations in queries

    Hello,



    I've been using another database software for years but just changed jobs and I have use Access now. I was told that Access can't use data from related tables to create calculation fields. That was my bread and butter in my other program. Now I don't even know how to start designing my database.

    I was advised to "Build a query. Or use domain aggregate function in textbox on form/report." Unfortunately, I don't see how either of those options will solve my problem and would really appreciate someone breaking it down for me.
    For simplicity, say I have a table, Project that contains the basic assumptions of my project. For each project there are things that change year to year, so I have a table, YearData. There are 30 years for each project. Now to calculate cost per year, I need to multiply the values in one year's record with the overal project assumptions. The end result would be a new field in YearData that is (Projects::assumption1)*(YearData::field1). How would I perform and store this calculation? Once performed would information update automatically if the dependent variables changed?

    Thanks

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    A basic principle of relational database is to save raw data and do calcs in queries. Saving calculated data, especially aggregate data, is usually not advisable.

    If calculated value must be saved to a table, that requires code.

    Build query that appropriately joins tables. Do calculations in the query or in textboxes on form or report. Access reports have features to allow summary calcs in headers and footers and still display detail records.

    You should probably get a tutorial book on Access and become familiar with its features.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    DB88 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    110
    My other software saved the calculation structure in a field and would produce the result as needed and a query was just to find records. I've been developing in FileMaker for 5+ years and now being forced into a different software I realize how unique it was.

    I agree a tutorial book would be helpful. Could you recommend a good one? None that I have seen show me how to create calculations in a query, just how to find records.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Any tutorial book should have info on building expressions. I have 3 very old books and all do. Look for Expression Builder or Calculated Fields (or Fields Adding Calculated) in the index.

    I never use the Expression Builder. I just type the expressions I want into the Field row of query designer. For example, say there are two fields named Quantity and Price, the expression would simply be:

    [Quantity] * [Price]

    Once you learn the operators and functions, typing is much faster than the Expression Builder.

    Search Access Help for references on building expressions.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. using calculations in queries
    By EWIG in forum Queries
    Replies: 3
    Last Post: 01-29-2014, 11:55 AM
  2. calculations
    By DariusD in forum Access
    Replies: 3
    Last Post: 01-01-2013, 07:22 PM
  3. Replies: 1
    Last Post: 10-08-2012, 03:35 PM
  4. Calculations on reports
    By BigMac4 in forum Reports
    Replies: 3
    Last Post: 09-14-2012, 02:33 PM
  5. calculations??
    By richrit in forum Access
    Replies: 1
    Last Post: 04-11-2012, 05:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums