PDA

View Full Version : Removing Special Characters From Textbox



mattster1010
03-23-2011, 05:15 AM
Afternoon All,

I'm using the follwoing code to update the table SOP30200 with information from an input form:

If Changed <> "" Then
SQL = "Update " & DBStrg & "SOP30200 "
SQL = SQL + "SET CUSTNAME = '" & TB_Custname.Text & "' "
SQL = SQL + ", CSTPONBR = '" & TB_Cstponbr.Text & "' "
SQL = SQL + ", CNTCPRSN = '" & TB_Cntcprsn.Text & "' "
SQL = SQL + ", SHIPTONAME = '" & TB_Shiptoname.Text & "' "
SQL = SQL + ", ADDRESS1 = '" & TB_Address1.Text & "' "
SQL = SQL + ", ADDRESS2 = '" & TB_Address2.Text & "' "
SQL = SQL + ", ADDRESS3 = '" & TB_Address3.Text & "' "
SQL = SQL + ", CITY = '" & TB_City.Text & "' "
SQL = SQL + ", STATE = '" & TB_State.Text & "' "
SQL = SQL + ", ZIPCODE = '" & TB_Zipcode.Text & "' "
SQL = SQL + ", COUNTRY = '" & TB_Country.Text & "' "
SQL = SQL + ", PRBTADCD = '" & CB_Addresses.Text & "' "
SQL = SQL + " where SOPNUMBE = '" & TB_SOPNUMBER.Text & "'"
Set rst = cn.Execute(SQL)


I like to replace the ' from the text entered into the textbox with a space for each textbox before updating the database.

Can anyone give any code examples of how to do this?

Regards,

Mattster

jrajul
03-27-2011, 06:01 AM
replace the ' from the text

Can you elaborate here? It sounds like you are talking about the FROM clause of an SQL statement but I am not quite clear on what you mean.