Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DSum Error 1

Status
Not open for further replies.

tacexpo

Technical User
Jul 23, 2007
16
US
I have an update Query based on two tables.
I would like to update tbl_BudMaster.VoucherAmt
where budgetkey is equal

here's the sql code i currently have

UPDATE tbl_BudMaster INNER JOIN tbl_Vregister ON tbl_BudMaster.BudgetKey = tbl_Vregister.BudgetKey SET tbl_BudMaster.VoucherAmt = DSum("budgetamt","tbl_Vregister")
WHERE (((tbl_BudMaster.BudgetKey)=[tbl_Vregister].[budgetkey]));

i have 3 records on tbl_Vregister.
Budgetkey | BudgetAmt
F0001 | $50
F0012 | $100
F0001 | $200

after i run the query, tbl_budMaster is being updated as follow

BudgetKey | VoucherAmt
F0001 | $350
..... |
F0012 | $350

why is it Dsuming fields that has a different budgetkey?
what am i doing wrong?


 
Code:
UPDATE tbl_BudMaster AS B INNER JOIN tbl_Vregister AS V ON B.BudgetKey = V.BudgetKey
SET B.VoucherAmt = DSum("budgetamt", "tbl_Vregister" ,"BudgetKey='" & B.BudgetKey & "'")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top