2014-10-29 38 views
0

任何人都可以請指教?新來這...我最初得到一個「無效不是空」的錯誤,並在我修改後,我現在得到語法錯誤。不是空語法錯誤

'Add notes about employee 
strsql = "SELECT [Employee Number], Declination, Leave, Termed, Comments " 
strsql = strsql & "FROM tmpMHPP " 
strsql = strsql & "WHERE Declination Is Not Null" 
strsql = strsql & "or Leave Is Not Null Or Termed Is Not Null Or Comments Is Not Null" 
+3

你在第三線('WHERE赤緯IS NOT NULL結束缺少空格之間'),所以這些字符串被連接爲'... NULLOR ...'。 – stakx 2014-10-29 18:42:32

回答

0

你錯過了

... Declination Is Not Null 

or Leave Is Not Null ... 
2

你缺少空間之間的空間。您需要添加一個空格不是null或

strsql = strsql & "WHERE Declination Is Not Null " 
               '^' 
strsql = strsql & "or Leave Is Not Null Or Termed Is Not Null Or Comments Is Not Null" 
0

這句法幫助避免這些錯誤

strsql = "SELECT [Employee Number], Declination, Leave, Termed, Comments" & _ 
     " FROM tmpMHPP" & _ 
     " WHERE Declination Is Not Null" & _ 
     " or Leave Is Not Null Or Termed Is Not Null Or Comments Is Not Null" 
+0

你不是在說錯誤是什麼。 ;)這就是說,我也做了很多相同的事情,但我習慣於在每行的末尾加上空格*和*。 – stakx 2014-10-29 18:48:27

+0

它是一個簡單的錯字,所以我提到這是一個附錄,並投票結束爲簡單錯字 – 2014-10-29 18:50:23