• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 625
  • Last Modified:

VBScript/ASP Function not returning value

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.
  • 2
1 Solution
Robert SchuttSoftware EngineerCommented:
You're not assigning anything to the function result "unstriptext", probably just replace "testnote" with that (3 times).
Robert SchuttSoftware EngineerCommented:
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.
Nico2011Author Commented:
Thanks very much - how daft of me!  Works fine now...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now