插入语句循环引用

时间:2014-07-08 11:46:06

标签: access-vba ms-access-2007

我在尝试运行以下代码时不断收到错误消息,并将[CID PERSON ID]称为循环引用。

        DoCmd.RunSQL "DELETE * from [tblOP_MASTER_FILE_PID]"
        DoCmd.RunSQL "INSERT INTO [tblOP_MASTER_FILE_PID]" & _
                     "SELECT [CID PERSON ID] from tblOP_MASTER_FILE"

2 个答案:

答案 0 :(得分:0)

您在两行SQL之间缺少空格

DoCmd.RunSQL "INSERT INTO [tblOP_MASTER_FILE_PID] " & _
-------------------------------------------------^
                     "SELECT [CID PERSON ID] from tblOP_MASTER_FILE"

答案 1 :(得分:0)

轻微修改但让它正常工作

DoCmd.RunSQL "INSERT INTO tblOP_MASTER_FILE_PID ( [Person ID] )" & _
             "SELECT tblOP_MASTER_FILE.[CID Person ID] from tblOP_MASTER_FILE"