I am having a problem trying to escape a "'" character when calling an onClick event. Here is the on click event code.
The FixApost(strName) function code is:
If strname = lname, f'name, it works.
if strname = lname, fna'me, I get an unterminating string error.
How can I keep the unterminating string error from appearing when the single quote is in the middle of a the last name?
TIA
Mike
Code:
strName = oRS.Fields("MEMBER")
response.write "onClick=" & chr(34) & "OpenInfo('" & .Fields("pid") & "','" & strWorkCenter& "','" & strDivision & "','" & FixApost(strName) & "')" & chr(34)
The FixApost(strName) function code is:
Code:
Function FixApost(pasString)
Dim tmpString
Dim iLoc
tmpString = pasString
iLoc = InStr(1,tmpString,"'")
If iLoc > 0 Then
While iLoc > 0
tmpString = Replace(tmpString, "'", "`")
iLoc = InStr(1,tmpString,"'")
Wend
End If
FixApost = tmpString
End Function
If strname = lname, f'name, it works.
if strname = lname, fna'me, I get an unterminating string error.
How can I keep the unterminating string error from appearing when the single quote is in the middle of a the last name?
TIA
Mike