andyb7901
asked on
VBA Replace Values
Hi,
Can someone tell me how I would replace a ' in my text field. If I try to update the field it screws up my query! The code I thought I mite use would be something like; (strMessage being my text field name)
If InStr(strMessage, "'") = 1 Then
Me("strMessage").Value = Replace(strMessage, "'", " ")
End If
Woudl this work?
Can someone tell me how I would replace a ' in my text field. If I try to update the field it screws up my query! The code I thought I mite use would be something like; (strMessage being my text field name)
If InStr(strMessage, "'") = 1 Then
Me("strMessage").Value = Replace(strMessage, "'", " ")
End If
Woudl this work?
Replace ' single quote with 2 single quote and all would be fine.
Me("strMessage").Value = Replace(strMessage, "'", "''")
Me("strMessage").Value = Replace(strMessage, "'", "''")
what value do you want as replacement?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If InStr(me("strMessage"), "'") =1 Then
Me("strMessage").Value = Replace(Me("strMessage"), "'", " ")
End If