Re: runtime error 3075..



> I keep getting a runtime error ...

Please post the runtime error, word verbatim next time.

> that says missing syntax on this piece of code, its driving me insane!
> I've tried passing allsorts to the query, even manually typing the record
i want to delete but it has no >effect!
>
> any ideas?

You could change the SQL command

> DoCmd.RunSQL "DELETE FROM email_Send WHERE EmailAddress =" & Del

so that as string is passed to DoCmd.RunSQL. That gives you chance to print
the SQL command.

But I suspect that your problem is with what Del contains. I am assuming
that EmailAddress is a character field. It may contain single-quote
characters and for SQL that is the escape chracter and needs doubling up
for the above to work. Or it may lack start and end single-quote characters.
They are not optional FROM is optional for DELETE command.
So

DELETE email_Send WHERE EmailAddress ='Cedar Street'
DELETE email_Send WHERE EmailAddress ='O''Malley Street'

Notice for "O'Malley Street" the single-quote character embedded within has
been repeated twice. That is essential for character fields. Notice also the
start and end single-quote characters. They are essential.
"Cedar Street" does not have any embedded single-quote characters so all it
has the start and end single-quote characters marking the start and end of
the string.

I would also suggest that when an application of yours is falling over on
trying to execute SQL, you post the SQL it is falling over on here.

Stephen Howe


.