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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Symbols causing problems in SQL statements

Status
Not open for further replies.

markronz

IS-IT--Management
Mar 20, 2007
93
US
Hello everyone-
I have just a basic "comments" form setup in Access that people can type their comments into. I then have another form, which queries the database, and displays the information. I am having problems when it comes to symbols. The comment section is free form, anything is allowed as far as symbols. So when I create an SQL insert query using the text from that textbox, it causes errors. Specifically when the user types in a " or ; or . and I'm sure others into my "comment" area. I was just wondering if anyone knew a way to insert the text into my database so that I don't have this problem? Is there a way to convert these symbols using the CHR function? I may be able to find a way to convert some of these problematic symbols myself, but I was wondering if anyone knew of a function which did this, or if there was some easier way than making some huge Function on my own.

Thanks
-Mark
 
Yes, I have had to do something like this before.

What I think its going to boil down to are two things...

1. There should be a way to escape these characters, but this will require my next suggestion...

2. You may have to call a function to replace your illegal characters with whatever you see fit. String replace functions are easy to find and download, if you don't feel like writing one yourself.

Gary
gwinn7

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top