When the sql contains the single quotes then they have to be properly escaped otherwise it will give errors
just pass the field value which you want to check and the following function will return you the properly escaped string.
eg. o’brien will be returned as o”brien and this will not cause your sql to break.
Function FixSql(ByVal sStr As String) As String
FixSql = Replace(sStr, “‘”, “””)