Why doesn't this work?

S

Steven M. Britton

db.Execute "DELETE FROM tblMM877R5 " & _
"WHERE (((Left([Field1],7))<>"DELETED" And
(Left([Field1],7))<>"Before" And (Left([Field1],7))<>"ADDED" And
(Left([Field1],7))<>"After")) OR (((Left([Field1],7)) Is Null));"


It highlights the "DELETED" and says Expected end of statement?
 
D

Duane Hookom

You must switch out your double-quotes for singles inside your string. This
might be easier to maintain (caution air coding):

db.Execute "DELETE FROM tblMM877R5 " & _
"WHERE Left(Nz([Field1],'DELETED'),7) Not In ('DELETED',
'Before', 'ADDED', 'After');"
 
Top