MS Access, update query will not update a linked table

笑着哭i 提交于 2019-12-11 11:03:45

问题


I have a remote user with a version of my db and a half dozen users interacting with front end versions of the db. The back end lives on the network drive. The remote user cannot use the network drive because it is too slow through the VPN. So daily or so I plan to update the db on the network drive with data from the remote user.

I have this query set up but it does nothing.

UPDATE Tbl2 
INNER JOIN Tbl1 
ON (Tbl1.thing1 = Tbl2.thing1) 
AND (Tbl2.[thing2] = Tbl1.[thing2])
AND (Tbl1.[thing3] = Tbl2.[thing3]) 
AND (Tbl2.[thing4] = Tbl1 thing4]) 
AND (Tbl1.[thing5] = Tbl2.[ thing5])
SET Tbl2.[ thing1] = [Tbl1].[ thing1], Tbl2.[ thing2] = [Tbl1].[ thing2], Tbl2.[ thing3] = [Tbl1].[ thing3], Tbl2.[thing4] = [Tbl1].[ thing4], Tbl2.[thing5] = [Tbl1].[ thing5];

I get no errors, no security warning and no output. Nothing changes in either table.

What am I missing?

Thank you!


回答1:


you're joining tables on all of their values and then updating them to the same values. If things 1 -> 5 are the compound primary key fields, then your update statement should update fields 6->n. If field1 is your PK field, then your update statement should update values for field2 -> fieldn.

In other words, whichever things you join on should not be updated.

HTH,

-Beth



来源:https://stackoverflow.com/questions/30674383/ms-access-update-query-will-not-update-a-linked-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!