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

adding slashes 1

Status
Not open for further replies.

stasJohn

Programmer
May 6, 2004
155
US
Is there a vb function like php's addslashes function?

Basically, I perform an sql statment like so...

select * from table where data = 'content\'s'

of course, content\'s is actually content's, and I need to add a slash before the apostrophe or else the query fails.

If there is no vb equivalent function, what method can I use?

thanks in advance
 
In Access one often "double" the quotes with the replace function:

[tt]"select * from table where data= '" & replace(myvar,"'","''") & "'"[/tt]

Or if using DAO, one can use "double quoting" to allow special charachters:
[tt]"select * from table where data= """ & myvar & """"[/tt]

Roy-Vidar
 
the replace function worked great... thanks!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top