SQL to Query text in access with an apostrophe in it

Viewed 144426

I am trying to query a name (Daniel O'Neal) in column names tblStudents in an Access database, however Access reports a syntax error with the statement:

Select * from tblStudents where name like 'Daniel O'Neal'

due to the apostrophe in the name.

How do I overcome this?

5 Answers

How about more simply: Select * from tblStudents where [name] = replace(YourName,"'","''")

Related