We help IT Professionals succeed at work.
Get Started

Search query - apostrophe - ERROR

JLohman asked
Last Modified: 2021-04-21
I am using
- MSAccess
- Microsoft SQL Server  2000 - 8.00.760 (Intel X86)
- FrontPage 2003

I have a sql query that works fine until someone inputs an apostrophe in the keyword search.  How do I modify the search criteria to ignore the apostrophe? My sql query is:
Dim objRS, StrKeyword, sql
	StrKeyword = request.form("Keyword")

sql = "SELECT * FROM tblBooks "
 		If StrKeyword <> "" then
			Sql = sql & "WHERE BookTitle LIKE '%" & StrKeyword & "%'" & _
			" AND ActiveTitle = 'Yes' "
		End If

Open in new window

Watch Question
Top Expert 2016
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE