I am having problems with the apostrophe in the SQL search string within a SubForm. Using "O'Mally's Apples" as an example. Following is a portion of my current VBA code that is giving me the problem.
MySearch = Replace(Me.TextSearch, "'", "''")
MySearch = "*" & MySearch & "*"
LineOne = "SELECT xxxxxxxxxx & vbNewLine
LineTwo = "From xxxxxxxxx & vbNewLine
The following line is where my problem is.
LineThree = "WHERE ((([GLItems].Item) Like '" & MySearch & "'))" & vbNewLine
LineFour = "ORDER BY xxxxxxx;"
MyCriteria = LineOne & LineTwo & LineThree & LineFour
stDocName = "[GLItemsSubform]"
Me![GLItemsSubform].Form.RecordSource = MyCriteria
If I search for "O'Mally's" the query returns (blank) If I search for "mally" it returns O'Mally's Apples
I can't just remove all of the apostrophe in the database and the Double apostrophes don't work in this situation
I am at my limit.
Please HELP...