Solved VBA to update a table with the sum of a field in another table (1 Viewer)

Capitala

Member
Local time
Today, 15:36
Joined
Oct 21, 2021
Messages
58
Thanks for your persistent support.
I have a table (transactions) with the columns: date; description, debit, credit and cost center. The second table is: Cost centers summary with the columns: const center and balance
I need a vba code to update the sum of credit (for example) into the table (cost centers) based on cost center
Best Regards
 

Attachments

  • Database3.accdb
    596 KB · Views: 309

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:36
Joined
May 7, 2009
Messages
19,242
it is not necessary to save Calculated values. you can calculate it on the fly (see Query1).
but if you want to save it (see your form).
 

Attachments

  • Database3.accdb
    628 KB · Views: 338

Capitala

Member
Local time
Today, 15:36
Joined
Oct 21, 2021
Messages
58
it is not necessary to save Calculated values. you can calculate it on the fly (see Query1).
but if you want to save it (see your form).
Thanks for your kind reply and directives. However, for some reason I need to do that by a vba code like: docmd.runsql ("update cost centers ....... set cost centers.debit=sum of( a field in a table or query). Is it possible?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 22:36
Joined
May 7, 2009
Messages
19,242
see your Form, i already made code to update your cost center table.
 

Users who are viewing this thread

Top Bottom