Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

db insertion - removing apostrophes

Status
Not open for further replies.

aamaker

Programmer
Jan 20, 2002
222
US
im have a form with a text field that the user, upon submission, is adding to the database (a simple access db)... problem is I need to prevent apostrophes from being written to the db...

I tried adding the following line before the insert statement

Code:
MM_formVal = Replace(MM_formVal,"'","''")

but that just prevents the submission from being written to the database alltogether (as opposed to only removing the apostrophe. withthout this line of code its added to the db( with the apostrophe) just fine though.
 
That code will replace one apostrophe with two. Try:
Code:
MM_formVal = Replace(MM_formVal,"'",[b][COLOR=blue]""[/color][/b])

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
my fault, that was one feeble attempt I made at trying to see where the issue was - I still get the same result though, and I've tried the empty quotes that you suggested.

Any other ideas?

Thanks for replying though.
 
I cant see why that doesn't work, paste this code into a page and see what happens
Code:
<%
MM_formVal = "O'Hanlon"
response.Write(MM_formVal)
MM_formVal = Replace(MM_formVal,"'","")
response.Write("<br>")
response.Write(MM_formVal)
%>

[Peace][Pipe]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top