Closed aledj2 closed 7 years ago
Add these lines before the query: If Not IsNull(Me![LastName]) Then ln = Me![LastName] ln = Replace(ln, "'", "''") Else ln = "unknown" End If If Not IsNull(Me![FirstName]) Then fn = Me![FirstName] fn = Replace(fn, "'", "''") Else fn = "unknown" End If
and use ln and fn in the query
The query which inserts patients into moka cannot deal with patients with apostrophes in the name
change this INSERT INTO patients (PatientID, sStatusOverall, MokaCreated, MokaCreatedBy, MokaCreatedPC, NHSNumber, BookinLastname, BookinFirstName, BookinDoB, BookinCreatedBy, BookinCreatedDate, BookinSex)" & "VALUES ('" & Me.PatientID & "', 1202218798,'" & D & "','" & un & "','" & cn & "','" & Me.NHSNo & "','" & Me.LastName & "','" & Me.FirstName & "','" & Me.DoB & "','" & Me.CreatedByID & "','" & Me.CreatedDate & "','" & Me.GenderShort & "')"