MS Access中的VBA中的查询表达式中的语法错误(缺少运算符)

时间:2013-02-13 19:01:46

标签: vba ms-access access-vba

我收到以下错误消息:查询表达式中缺少3075运算符

这里有一小段代码:

Dim dbs As Database
Set dbs = CurrentDb()
dbs.Execute "DELETE FROM TempTable_Entity_mapping_DEFSET_Selection;"
Do While Not rsDEFSET.EOF
    Debug.Print rsDEFSET.Fields.item("RESULT").Value
    MIP = rsDEFSET.Fields.item("FK_DIM_MBR_ITEM").Value
    KPIName = rsDEFSET.Fields.item("SHORTNAME_MBR").Value
    ID = rsDEFSET.Fields.item("RESULT").Value
    DefSetName = rsDEFSET.Fields.item("KPI_DEFSET_NAME")
    Scenarios = rsDEFSET.Fields.item("SCENARIOS")

    fillTempTab = "INSERT INTO TempTable_Entity_mapping_DEFSET_Selection (MIP, KPIName, ID, DefSetName, Scenarios) VALUES ('" & MIP & "','" & KPIName & "','" & ID & "','" & DefSetName & "','" & Scenarios & "');"
    Debug.Print fillTempTab
    dbs.Execute fillTempTab
    rsDEFSET.MoveNext
Loop

1 个答案:

答案 0 :(得分:0)

看起来你错过了你想在SQL语句中删除的内容

您的第一个查询应该是

DELETE * FROM TempTable_Entity_mapping_DEFSET_Selection;