Results 1 to 7 of 7
  1. #1
    Rafegh is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2014
    Posts
    13

    Add sum of data to a record related in another table

    Dear all, hi



    I want to have a database that consists of two tables. How can I add sum of data in a field from a number of records to a field of a record related to these records in another table?

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Why would you want to duplicate the data? Explain!

  3. #3
    Rafegh is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2014
    Posts
    13
    Think of that I want this database for a company that sells different stuffs in different cities. I have table #1 which has one record for each stuff and table #2 which has one record for each city and stuff that has the number of the stuff sold in a city. Now I want to have a sum of the stuff sold in all the cities that I want it to be aggregated from table #2 and after that be added to the according field in table #1. Could I explain my problem?<br><br>

  4. #4
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Are you wanting this in a query, a form or what? If the 2 tables are linked, then the data can easily be displayed. Do you have a form/subform setup?

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Saving calculated data is usually a bad idea, especially aggregate data. This should be calculated when needed.

    The same query is required to do derive the data for saving to table. Don't do the extra step of saving, just report the calculated data.
    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.

  6. #6
    Rafegh is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jul 2014
    Posts
    13
    Actually I want to have a calculated field in table #1 that gets the data from the related records of table #2.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    That is not possible. The Calculated type field is not capable of this. This must be done in query. That's what queries are for - data manipulation.
    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. Replies: 40
    Last Post: 08-20-2013, 11:38 PM
  2. Replies: 7
    Last Post: 11-02-2012, 12:05 PM
  3. Replies: 7
    Last Post: 07-02-2012, 10:50 PM
  4. Go To Record with related table Primary Key
    By jamiebull21 in forum Forms
    Replies: 3
    Last Post: 02-17-2012, 09:36 AM
  5. Foce new record in related table?
    By thekruser in forum Access
    Replies: 1
    Last Post: 11-08-2010, 02:00 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