Results 1 to 6 of 6
  1. #1
    jeanweaves is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    3

    How to get calculation results to store in the related table


    I have a form ("Orders") with a subform ("Orders Details"). I have "Subtotal" and "SalesTax" fields on the form that calculate those figures from the subform. The calculations work fine on the form but the results do not show up in the related table. The manually entered "Shipping Cost" does show but not the fields that calculate. What am I doing wrong?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jeanweaves is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    3
    So if I shouldn't be storing the order subtotal and sales tax in the orders table, how or where does Access store the information entered in the Orders form?

  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
    52,930
    Enter raw data, do calcs as needed.

    Aggregate data should never be stored, unless there is some sort of archiving process. Another Allen Browne article http://allenbrowne.com/AppInventory.html.

    Save the sales tax rate in the order record if there is possibility the rate will change and don't want existing records affected by newer rate. But calculate the tax amount in query or in textbox.
    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.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The rule of thumb is not to store data that can be calculated from other data. You would calculate the subtotal from the detail records.

    I take care of an accounts receivable app designed by another developer with similar header/detail tables. He stored the sum of the detail records in the header record. Despite code designed to keep them in sync, I've had to create a nightly process that checks for instances where they aren't (where the total of the detail records doesn't match the value in the header). Users have an almost magical ability to get around your code. I think they do the 3-finger-salute to exit the program in my case.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    jeanweaves is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    3
    Thanks for the input. I'll take another look at the design and make some changes.

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

Similar Threads

  1. store query results into table
    By gammaman in forum Programming
    Replies: 3
    Last Post: 06-27-2013, 01:35 PM
  2. Replies: 3
    Last Post: 02-05-2013, 07:47 AM
  3. How to store ID on list box but show related data
    By Clarionchanger in forum Access
    Replies: 3
    Last Post: 10-11-2012, 03:31 PM
  4. Replies: 2
    Last Post: 08-15-2012, 09:04 AM
  5. Replies: 1
    Last Post: 06-26-2012, 05:02 PM

Tags for this Thread

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