Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


VBScript/ASP Function not returning value

Posted on 2012-08-20
Medium Priority
Last Modified: 2012-08-20
Hello Experts,

I've written a short function to replace characters in a string called from a database, but it doesn't seem to work... I usea similar function, written in the same way, and that does work, so I'm really confused!

Here's how I call the function:

adminnotes = unstriptext(RS("adminnotes"))

Open in new window

Admin notes currently holds the value 'test'

And here's the function, which is held in a seperate file which is inculded at the top of my page:

function unstriptext(note)
if len(note) > 0 then 
testnote = Replace(note, "''", "'")
testnote = Replace(testnote, CHR(13), "<BR>")
end if
end function

Open in new window

Thanks in advance for your help.
Question by:Nico2011
  • 2
LVL 35

Accepted Solution

Robert Schutt earned 2000 total points
ID: 38311213
You're not assigning anything to the function result "unstriptext", probably just replace "testnote" with that (3 times).
LVL 35

Expert Comment

by:Robert Schutt
ID: 38311222
NB: if len(note) = 0 then the function returns an empty value which may not be the intention. You could add an 'else' part for that.

Author Closing Comment

ID: 38311239
Thanks very much - how daft of me!  Works fine now...

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses
Course of the Month11 days, 9 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question