This is a function to format field strings that contain apostrophes for processing by an SQL server
This is a function to format field strings that contain apostrophes for processing by an SQL server.
Rate This is a function to format field strings that contain apostrophes for processing by an SQL server
(1(1 Vote))
' Format Apostrophes For SQL Statement
Dim ChrPos As Long, PosFound As Long
Dim WrkStr As String
For ChrPos = 1 To Len(StrFieldVal)
PosFound = InStr(ChrPos, StrFieldVal, "'")
If PosFound > 0 Then
WrkStr = WrkStr & Mid(StrFieldVal, ChrPos, PosFound - ChrPos + 1) & "'"
ChrPos = PosFound
Else
WrkStr = WrkStr & Mid(StrFieldVal, ChrPos, Len(StrFieldVal))
ChrPos = Len(StrFieldVal)
End If
Next ChrPos
FormatSQL = WrkStr
End Function
This is a function to format field strings that contain apostrophes for processing by an SQL server Comments
No comments yet — be the first to post one!
Post a Comment