Selasa, 26 Februari 2013

RE: [MS_AccessPros] replace(me.control,""","")

 

John, I'm getting a syntax error on my test.

This bit of code:
Me.Text0 = Replace(Me.Text0, """", """""")
Dim strsql As String
strsql = "Insert into tmptable textfield values ('" & Me.Text0 & "');"
CurrentDb.Execute (strsql)

From this text box value:
this is a "test"

Gives this strsql result:
Insert into tmptable textfield values ('this is a ""test""');

Respectfully,
Liz Ravenwood
Programmer/Analyst
Super First Class Products
B/E Aerospace
O: 1.520.239.4808
www.beaerospace.com

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of John Viescas
Sent: Tuesday, February 26, 2013 3:15 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: RE: [MS_AccessPros] replace(me.control,""","")

Liz-

If you suspect "bad" quotes in an incoming string, do this:

Me.txtStuff = Replace(Me.txtStuff, """", """""")

That will embed double-double quotes in the string that will work OK if you're using double quotes to delimit your string.

John Viescas, Author

Microsoft Access 2010 Inside Out

Microsoft Access 2007 Inside Out

Microsoft Access 2003 Inside Out

Building Microsoft Access Applications

SQL Queries for Mere Mortals

http://www.viescas.com/

(Paris, France)

From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Liz Ravenwood
Sent: Tuesday, February 26, 2013 11:03 PM
To: MS_Access_Professionals@yahoogroups.com'
Subject: [MS_AccessPros] replace(me.control,""","")

Pros,

I cannot believe that I've been fortunate enough that my users have been trained well enough not to use the double quotes in some of my stuff that relies on an sql statement behind the scenes, but I need to get rid of double quotes or at least replace them with an acceptable char.

How do I do this?

Respectfully,
Liz Ravenwood
Programmer/Analyst
Super First Class Products
B/E Aerospace
O: 1.520.239.4808
www.beaerospace.comhttp://www.beaerospace.com>

This email (and all attachments) is for the sole use of the intended
recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

This email (and all attachments) is for the sole use of the intended recipient(s) and may contain privileged and/or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar