SQL Update Table的参数数量错误

时间:2017-08-29 14:54:35

标签: sql access-vba

我正在尝试将不同表格中的ID添加到表格RUSER_KSP_S_TI_ARP

strSQL = "UPDATE RUSER_KSP_S_TI_ARP 
          SET RUSER_KSP_S_TI_ARP.ID_FZG = TI_IDENTIFIKATION.ID_FZG,
              RUSER_KSP_S_TI_ARP.ID_PULK = TI_IDENTIFIKATION.ID_PULK 
              WHERE RUSER_KSP_S_TI_ARP.ARP = TI_IDENTIFIKATION.ARP 
              AND RUSER_KSP_S_TI_ARP.BTNR = TI_IDENTIFIKATION.BTNR;"
CurrentDb.Execute strSQL, dbFailOnError

返回错误3061,表示它预期有4个参数并且很少。

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

您需要加入TI_INDENTIFICATION。

strSQL = "UPDATE ruser
          SET ruser.ID_FZG = ti.ID_FZG,
              ruser.ID_PULK = ti.ID_PULK
          FROM RUSER_KSP_S_TI_ARP ruser
          INNER JOIN TI_IDENTIFIKATION ti
                  ON ruser.ARP = ti.ARP AND ruser.BTNR = ti.BTNR;"
CurrentDb.Execute strSQL, dbFailOnError