Hi everyone,
I am not sure if anyone else has had this problem but I am using FindFirst for a Id of a new patient as I would like to update the details if it already exists. The FindFirst does NOT find a matching record but I know it exists!!
The Ids contain letters and punctation (legacy data...). There is a patient with Id = "O'HARA1" (without the double quotes) in the table.
The patient with new details with Id of "O'HARA1" comes along so I want to perform an update on the existing row.
My problem is that the current patient isnt found with the following code.
rstCurrentPatients.NoMatch seems to be always true even though a record exists.
My FindFirst criteria is "Id = 'O''HARA1'".
I have also tried Chr(34) as other posts suggest...
but still NoMatch is true.
I am using Access 2010. I hope someone can help?
Thanks in advance,
Tanya
I am not sure if anyone else has had this problem but I am using FindFirst for a Id of a new patient as I would like to update the details if it already exists. The FindFirst does NOT find a matching record but I know it exists!!
The Ids contain letters and punctation (legacy data...). There is a patient with Id = "O'HARA1" (without the double quotes) in the table.
The patient with new details with Id of "O'HARA1" comes along so I want to perform an update on the existing row.
My problem is that the current patient isnt found with the following code.
Code:
rstCurrentPatients.FindFirst ("Id = '" & SQLText(rstNewPatients("Id")) & "'")
My FindFirst criteria is "Id = 'O''HARA1'".
I have also tried Chr(34) as other posts suggest...
Code:
rstCurrentPatients.FindFirst ("Id = " & Chr(34) & SQLText(rstNewPatients("Id")) & Chr(34))
Code:
Function SQLText(ByVal ST As String) As String
Dim tempString As String
tempString = Replace(ST, "'", "''")
SQLText = tempString
End Function
I am using Access 2010. I hope someone can help?
Thanks in advance,
Tanya