[AccessD] Function for "scrubbing" strings before inserting them into SQL statements?

Drew Wutka DWUTKA at marlow.com
Fri May 2 14:22:46 CDT 2003


That should work, but I personally would write it:

Replace(mystring,Chr(34),Chr(34) & Chr(34))

Drew

-----Original Message-----
From: Michael Tucker [mailto:mtucker at myrealbox.com]
Sent: Friday, May 02, 2003 2:10 PM
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Function for "scrubbing" strings before inserting
them into SQL statements?


Thanks for the response.  My brain is a little fuzzy on this, all these
quotation marks are turning my eyes to mush...

Replace (mystring, """", """""")

Is this what I'm looking for or is there a better way using chr codes and
what not?


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Drew Wutka
Sent: Friday, May 02, 2003 12:08 PM
To: 'accessd at databaseadvisors.com'

Use the replace function, to replace all double quotes, with two double
quotes.

Drew

-----Original Message-----
From: Michael Tucker [mailto:mtucker at myrealbox.com]
Sent: Friday, May 02, 2003 10:47 AM
To: accessd at databaseadvisors.com
Subject: [AccessD] Function for "scrubbing" strings before inserting them
into SQL statements?


Hi everyone,

I'm sure everybody has faced this situation, but I can't seem to figure out
an elegant solution.  I have a webpage interface to an Access database where
users can enter notes on various things.  Of course the user may enter
apostrophes or quotation marks in these notes, but of course that sends my
SQL statement into a tizzy.  A sample of my SQL statement...

strSQL = "INSERT INTO tblEmployeeMonthlyTask ([TaskDescription]) VALUES "
strSQL = strSQL & "('" & Request.Form("txtTaskDescription") & "')"

Is there a function that will convert my string so that it usable inside of
this SQL statement even if it contains apostrophes and quotes?

Thank you.

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list