I have a SQL search on the main page of my database which gives me run-time error 3075 "Syntax error" whenever my search_text value includes an apostrophe, e.g. "Susan O'Connor"
Here's my code which is triggered when I hit search:
What do I need to add to the syntax to allow apostrophes?
Here's my code which is triggered when I hit search:
Code:
sql_search = "SELECT * from dbo_users
where job_title not like '*N/A - ACCOUNT RENAMED*' and
owner_name like '*" & search_text & "*' order by surname asc, forename asc"
Forms![frm_main2]![subfrm_main2_search].Form.RecordSource = sql_search
What do I need to add to the syntax to allow apostrophes?