I have a select statement that checks whether an address exists in the table.
Quite a few street names have apostrophes in the name
Adam's Pond Road
Dim strCompare, strSQL As String
Dim db As Database
Dim rs As DAO.Recordset
strCompare = Me.sStreetNumber & " " & iStreetName.Column(1)
as an example.....
strCompare = 3 Adam's Pond Road (which plugs into the select statement)
Set db = CurrentDb
strSQL = "SELECT * FROM qryresidences WHERE Res = '" & strCompare & "' "
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset, dbSeeChanges)
If rs.EOF = False Then
MsgBox "That address exists already"
I keep getting an syntax error because of the apostrophe.
Any insight or help would be greatly appreciated.