按一个按钮将值从一个表插入另一个表

时间:2016-11-16 15:02:17

标签: sql access-vba access insert-update

我有一个名为" tbl_Update"的选择查询和一个名为" tbl_A"在Access DB中。我想按下一个按钮,它会产生以下结果: 看着田野" KW"当它们匹配时(在下面这个例子中,值" 2016.45"匹配),然后插入" tbl_update.CA041073p"的值。进入" tbl_A.CA041073p"。似乎很容易,但总是犯错误。任何简单的解决方案怎么做?谢谢!

我的代码如下,它给了我错误3037:

Public Function Update()

 DoCmd.RunSQL "Update tbl_A INNER JOIN tbl_Update " & _ 
 "ON tbl_A.KW = tbl_Update.KW " & _ 
 "SET tbl_A.CA041073p = [tbl_Update].[CA041073p] "

End Function

enter image description here

1 个答案:

答案 0 :(得分:0)

One quite likely reason is that the user running the program doesn't have read-write access to the database file, especially if it is located in program files folder.

So check the directory and file permissions and modify them if needed. You can also consider changing the location of the database file to another, more easily accessible folder.