Results 1 to 2 of 2
  1. #1
    jgitaunjoroge is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2014
    Location
    Kenya
    Posts
    5

    Update main table from subform of main mainform afterupdate

    Am experiencing difficulties in updating main table after doing update from subform. i have two tables Customer and Customertrans. Customer should be updated when user updates customertrans through subform. After update of subform (customertrans table) i would like to sum all amount for accno=SCM0134 and update customer.paid column with the sum amount. Am not able to achieve this.



    Customer

    1. ACCNO ACCNAME DESCRIPTION CONTRACT WORKDONE INVOICED WIP PAID BALANCE
    2. SCM0134 PETER MUTUKU SUPPLY OF 2NOS. H/D CONCRETE MIXER CW ENGINE 649,600.00 400,000.00 -400,000.00 -400,000.00



    Customertrans
    1. ACCNO ACCNAME DESCRIPT CUMMBAL AMOUNT INVOICED BALANCE
    2. SCM0134 PETER MUTUKU SUPPLY OF 2NOS. H/D CONCRETE MIXER CW ENGINE -200000 2 -200000
    3. SCM0134 PETER MUTUKU SUPPLY OF 2NOS. H/D CONCRETE MIXER CW ENGINE -400000 -200000 -400000
    4. SCM0134 PETER MUTUKU SUPPLY OF 2NOS. H/D CONCRETE MIXER CW ENGINE 400000 0
    5. SCM0134 PETER MUTUKU SUPPLY OF 2NOS. H/D CONCRETE MIXER CW ENGINE -500000 -100000 -500000
    6. SCM0134 PETER MUTUKU SUPPLY OF 2NOS. H/D CONCRETE MIXER CW ENGINE -648600 -148600 -648600
    7. SCM0134 PETER MUTUKU SUPPLY OF 2NOS. H/D CONCRETE MIXER CW ENGINE 248600 0



    Thanks
    Joseph

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    it is an incorrect design to write the sub table's sum into the main table. the sub table sum is always available as an aggregate for use/display anytime you need - so writing it to the main table is unneeded plus actually introduces potential flaws involving the necessary triggers to be sure an overwrite always occurs when a change occurs. Also were this a large db with many users - one avoids all those writes happening......

    having said that; the way to do it is to make an Aggregate Query that creates the correct sum, and then make an Append Query using the Aggregate query - - you must determine when to trigger those, and also to refresh/requery the form.

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

Similar Threads

  1. Replies: 5
    Last Post: 04-30-2015, 01:50 AM
  2. Replies: 8
    Last Post: 05-30-2013, 05:06 PM
  3. Update Main Form From Subform
    By burrina in forum Forms
    Replies: 7
    Last Post: 02-06-2013, 03:55 PM
  4. Requery subform after update of main form
    By gemadan96 in forum Forms
    Replies: 3
    Last Post: 10-17-2012, 02:33 PM
  5. Replies: 2
    Last Post: 06-09-2012, 01:56 AM

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