The following SQL statement 'runs' fine unless one of the strings rstContact!Firs tNames or rstContact!Fami lyName contains an apostrophe. I can see why this causes a syntax error, but don't know how to cure it!
Well, actually I DO know how to cure it: by using VBA code (.AddNew ... .Upate) on a recordset, but this is going to be a massive job throughout my project. It will, of course, have to be done if there's no way of "hiding" the apostrophes from SQL!
Code:
"INSERT INTO TEMP_NOT_GOT_SMI (ContactID,FirstNames,FamilyName,OrganisationID) VALUES (" & rstContact!ContactID & ",'" & rstContact!FirstNames & "','" & rstContact!FamilyName & "'," & rstContact!OrganisationID & ")"
Comment