Hi all,
I have a chunk of sql in an Access module (Access 2003 btw) which runs perfectly until it hits a row where the surname has ' in it e.g. O'Brien. It fails on this. I've posted the code below, can anyone help me find a way to get it to work?
I have a chunk of sql in an Access module (Access 2003 btw) which runs perfectly until it hits a row where the surname has ' in it e.g. O'Brien. It fails on this. I've posted the code below, can anyone help me find a way to get it to work?
Code:
Set d = CurrentDb
Set r = d.OpenRecordset("qryTriggersNotifyManagers2", dbOpenDynaset) 'open the recently created table
r.MoveFirst 'move to the first record
Do Until r.EOF
strsql = "INSERT INTO tblAllTriggersForServiceBoardsArchive"
strsql = strsql & " (Forename, Paynumber, title, Surname)"
strsql = strsql & " VALUES ( '" & r!Forename & "','" & r!PayNumber & "', '" & r!Title & "', '" & r!Surname & "') "
CurrentDb.Execute strsql, dbFailOnError
r.MoveNext
Loop
r.Close
Set r = Nothing
Comment