> Is anyone knows why I can't update table in access when I using single
Actually, you can. But then you have to update the record by use of
the "update" property of a recordset.
I believe you are trying to do it with an SQL update statement, and then
the (') character is interpreted as "end of line" and the SQL interpreter
gets an invalid SQL statement.
I use the following function to check for (') within the string that I
want to include in the SQL statement.
---------------------------------------
Function sqlSyntax(sqlString As String) As String
'Check the sql string for the character '
Dim strTemp As String
Dim chrPos As Long
Dim lFor As Long
strTemp = ""
lFor = Len(sqlString)
For chrPos = 1 To lFor
strTemp = strTemp & Mid(sqlString, chrPos, 1)
If Mid(sqlString, chrPos, 1) = "'" Then strTemp = strTemp & "'"
Next
sqlSyntax = "'" & strTemp & "'"
End Function
-------------------------------------------
Example:
update myTable set myField = sqlSyntax(myString & "") where .....
I add a zero-length string to "myString" in order to cope with the cases
where the string I want to write to the database (myString) is NULL.
Kind regards
Leif