moka-guys / moka-fe

This repo is incomplete and serves as a backup of some code from Moka. It includes some legac(hitt)y code.
0 stars 4 forks source link

87026 code behind new EK number #246

Closed aledj2 closed 7 years ago

aledj2 commented 7 years ago

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 & "')"

aledj2 commented 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