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

Apostrophe ' in text box 1

Status
Not open for further replies.

sk1hotpepr

Technical User
Jul 11, 2003
63
US
How do you work around a name that contains an apostrophe?
Ex: O'Neal.

Do you strip it out somehow? If so - how?

Thanks in advance!
 
Does the apostrophe cause any problems in the text control? Wouldn't O'Neal be a bit dissapointed with being called ONeal, you think?

If you have some problems with the apostrophes in the control, perhaps tell us what it is, see for instance faq181-2886 #14 on how to get the best answers.

Roy-Vidar
 
Sorry. I have a text box that allows the user to type in a name. When I try to find that specific record to edit, I get an error.
 
Use Replace to double the ' in your query for sql. (Not in the text box).
e.g. ...Replace([yourtxtbox], "'", "''")...

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
The replace thingie by traingamer would do, else one often uses a combo. When created through the wizard, third option "find a record on my form...", which uses the primary key of the form recordsource in the search;-)

Roy-Vidar
 
Thank you for your help! The replace thing worked for me fine. I had created my combo boxes through the wizard but when I created the recordset.Find, I would get the error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top