我一直在得到錯誤「附近關鍵字不正確的語法」,其中「。」。請幫我調試我的sql查詢!
DoCmd.RunSQL "insert into userPreferences (userId, GroupId, preferenceId, properties, isDefault)" & _
"select " + Me.UserId + ", " + Me.GroupId + ", preferenceid, properties, 1 from preferences " & _
" where preferenceId not in " & _
"(select preferenceId from userPreferences where GroupId = " + Me.GroupId + _
" and userId = " + Me.UserId + _
") and preferenceid not in " & _
"(select preferenceid from GroupPreferences " & _
"where cabGroupId = " + Me.GroupId + " and override = 0)"
我不清楚爲什麼你使用+連接運算符而不是& - +傳播空值並執行算術運算,如果雙方都可以對數值有價值的東西進行強制操作,並且只應在明確要傳播時使用空值。 – 2010-10-25 17:57:46
原來是這個問題 - 我本來應該用&代替+。如果您輸入這個答案,我會將其標記爲已接受的答案。 – dmr 2010-10-25 18:13:50