I am writing a SELECT statment which will include the values in a text box and bound to the data source. My code is as follow.
strSQL = "Select * from table1 where Field1 = '" & txtBox & "'"
datSource.Recordsource = strSQL
What my problem is when I have a ' in the text box which will cause error in the SQL statment.
eg. If the txtBox.Value = "Mary's Car", then the strSQL will be "Select * from Table1 where field1 = 'Mary's Car'"
what is the cure for this?? Thanks