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

apostrophy error

Status
Not open for further replies.

Trillithium

Technical User
Dec 9, 2000
27
0
0
NL
Hi,

When I enter a word with an apostrophy ( like 's or s') into a textbox/field and submit it to a database (access) I get an "operator missing syntaxis error" in my query expression. Can somebody tell me what to do.

Thanx
 
You need to add the escape character, which, strangely enough, is the apostrophe --

Just run this on all strings you are going to run to the db --

replace(string, "'", "''")

So that every time it finds an apostrophe, it replaces it with two apostrophes.

Although, if you want to really save yourself some headaches and you have creative control over the data, just make apostrophes illegal, and run this on the strings:

replace(string, "'", "")

To just take them out --

Of the two, I highly recommend the second option, but not everyone is lucky enough to be able to make that rule.

good luck! :)
Paul Prewett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top