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!

Stuck on replace command

Status
Not open for further replies.

TRACEYMARYLAND

Programmer
May 21, 2004
370
US
I have this
BLOWER_SERIAL_NUMBER = rtrim(request.form("BLOWER_SERIAL_NUMBER"))
BLOWER_SERIAL_NUMBER = replace(BLOWER_SERIAL_NUMBER,"'", "''")


My replace is giving me a syntax error
I cannot figure it out
 
be careful Replace or trim functions throw errors when the field is null

so check for nulls...something like this

if BLOWER_SERIAL_NUMBER <>"" then
BLOWER_SERIAL_NUMBER = replace(BLOWER_SERIAL_NUMBER,"'", "''")
end if

-L

 
actually u can do this too...

if request.form("BLOWER_SERIAL_NUMBER") <>"" then
BLOWER_SERIAL_NUMBER = replace(rtrim(request.form("BLOWER_SERIAL_NUMBER")),"'", "''")
end if

-L
 
It's also worth noting that you may want to use the full Trim() function rather than just RTrim(), since you probably don't want spaces at the beginning, either.
 
Actually its best not to use Request.Form twice on the same object you should dump them into a String first then use the string.

www.sitesd.com
ASP WEB DEVELOPMENT
 
Oh i did not know about the null...or full trim

Thanks......to all of you.
 
full trim...what the command for that i can only
see ltrim or rtrim

cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top