我需要更新表格中的现有记录。
我一直在尝试两种不同的方法,但却看不到我错过的内容:
首次尝试是:
SELECT * from TABLEA T WHERE
(Parameter='Location' AND DataValue = 'New York' )
AND EXISTS (
SELECT * FROM TABLEA T1 WHERE T1.id= T.id
AND ( T1.Parameter='Business' AND T1.DataValue = 'SME'))
第二次尝试:
CurrentDb.Execute "UPDATE [MS Access;pwd=" & strPassword & ";database=" & DBpath & "\" & DBname & "].[" & tblengagement & "] SET [Close_Time] = #" & Time & "#, WHERE ID = '" & SessionID & "'"
收到错误: 语法错误
更新我的代码:
CurrentDb.Execute " UPDATE [MS Access;pwd=" & strPassword & ";database=" & DBpath & "\" & DBname & "].[" & tblengagement & "] " _
& "(Close_Time) VALUES " _
& "(#" & Time & "#)" _
' & "WHERE ID = '" & SessionID & "';"
答案 0 :(得分:0)
正确的代码:
CurrentDb.Execute "UPDATE [MS Access;pwd=" & strPassword & ";database=" & DBpath & "\" & DBname & "].[" & tblengagement & "] " _
& "SET [Close_Time] = #" & Time & "# WHERE ID = '" & SessionID & "';"
问题是什么: 我在代码中留下了,,一旦删除就可以了。