Greetings,
I'm trying to update values of one table from another table by adding to existing values.
I have two table , tbl1 and tbl2
in tbl1 i have items and qty same in tbl2 items and qty
now i would like to update tbl1.qty using RunSql with data from tbl2.qty
so if in tbl1.qty = 5, by clicking on the button I would like to add values from tbl2 (if tbl2.qty = 3 ) so i have tbl1.qty = 8
I would really appreciate if since im really running out of the opitions here.
P.S. i used SQL 2010 and this worked there but not in ms Access vba
DoCmd.RunSQL "UPDATE tbl1 SET tbl1.[Qty] = (SELECT (tbl1.[Qty] + tbl2.[Qty]) As total FROM tbl1 AS t1 INNER JOIN tbl2 AS t2 ON t1.[ID] = t2.[ID] WHERE t1.[ID] = tbl1.[ID])"
thank you in advanced
Best Regards
I'm trying to update values of one table from another table by adding to existing values.
I have two table , tbl1 and tbl2
in tbl1 i have items and qty same in tbl2 items and qty
now i would like to update tbl1.qty using RunSql with data from tbl2.qty
so if in tbl1.qty = 5, by clicking on the button I would like to add values from tbl2 (if tbl2.qty = 3 ) so i have tbl1.qty = 8
I would really appreciate if since im really running out of the opitions here.
P.S. i used SQL 2010 and this worked there but not in ms Access vba
DoCmd.RunSQL "UPDATE tbl1 SET tbl1.[Qty] = (SELECT (tbl1.[Qty] + tbl2.[Qty]) As total FROM tbl1 AS t1 INNER JOIN tbl2 AS t2 ON t1.[ID] = t2.[ID] WHERE t1.[ID] = tbl1.[ID])"
thank you in advanced
Best Regards