S
Steve
I would like to sum a field in a Table2 and update a field in a Table1 with
the total where a particular field matches.
ie, Table1 has a list of ITEMS with a field called USAGE and the ITEMS field
is a primary field. Table2 has the ITEMS field and a QTY field but the ITEMS
field is duplicated for each QTY transaction. I want to add up the QTY field
for each unqiue ITEMS in Table2 and update the USAGE field in TABLE1 for the
corresponding ITEMS.
I tried to build a query in Access by pulling up the two tables and linking
the ITEMS field then updating the USAGE field in TABLE1 with
Sum([table2.qty]). I try to run it and get an error that I tried to execute
a query where USAGE is not part of the aggragate. It shows a query of UPDATE
Table1 INNER JOIN Table2 ON Tablw1.ITEMS = Table2.ITEMS SET Table1.[USAGE] =
Sum([Table2].[qty]);
I also tried hand typing it as UPDATE Table1 SET Table1.[USAGE] =
Sum([table2].[qty]) where table1.items = table2.items;
Can anyone help me with where I am going wrong?
the total where a particular field matches.
ie, Table1 has a list of ITEMS with a field called USAGE and the ITEMS field
is a primary field. Table2 has the ITEMS field and a QTY field but the ITEMS
field is duplicated for each QTY transaction. I want to add up the QTY field
for each unqiue ITEMS in Table2 and update the USAGE field in TABLE1 for the
corresponding ITEMS.
I tried to build a query in Access by pulling up the two tables and linking
the ITEMS field then updating the USAGE field in TABLE1 with
Sum([table2.qty]). I try to run it and get an error that I tried to execute
a query where USAGE is not part of the aggragate. It shows a query of UPDATE
Table1 INNER JOIN Table2 ON Tablw1.ITEMS = Table2.ITEMS SET Table1.[USAGE] =
Sum([Table2].[qty]);
I also tried hand typing it as UPDATE Table1 SET Table1.[USAGE] =
Sum([table2].[qty]) where table1.items = table2.items;
Can anyone help me with where I am going wrong?