這樣寫是不對的,因為這意味著三個條件中只要有任何壹個成立,結果就成立。比如c=3時,盡管第壹個條件不成立,但後面兩個條件是成立的,因此整個表達式就成立。這就意味著,不管是什麽數(包括3、4、5)結果都是成立的!
應該改為
if a=1 and b=2 and c<>3 and c<>4 and c<>5 then
代碼中的則改為
if xm = rs("sb") and rs("jd") ="審查" and dj<>1 and dj<>2 and dj<>3 and dj<>4 then
或者
if xm = rs("sb") and rs("jd") ="審查" and (dj<1 or dj>4) then
或者
if xm = rs("sb") and rs("jd") ="審查" and not (dj>0 and dj<5) then