Print Page | Close Window

Weird Replace Problem

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=7957
Printed Date: 01 April 2026 at 4:22am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Weird Replace Problem
Posted By: WookMaster
Subject: Weird Replace Problem
Date Posted: 09 December 2003 at 6:06am

Im using this: 

Response.write Replace(rsJobsearch("jobdesc"),Chr(13) & Chr(10),"<br>")

I dont know why it quit working it was working great,  jobdesc is a memo in the access database.  Any ideas why I would get this error?  Thanks

Microsoft VBScript runtime error '800a005e'

Invalid use of Null: 'Replace'




Replies:
Posted By: TYSON
Date Posted: 09 December 2003 at 6:29am

My guess would be that JobDesc of one of your rows is Null , You could try something like this

If rsJobsearch("jobdesc") <> "" Then
   Response.Write(Replace(rsJobsearch("jobdesc"),Chr(13) & Chr(10),"<br>"))
Else
   Response.Write(rsJobsearch("jobdesc"))
End If

 



-------------
http://www.fuo-motorsports.com/ - http://www.fuo-motorsports.com/


Posted By: Scotty32
Date Posted: 09 December 2003 at 6:29am

maybe becose there is nothing IN "rsJobsearch("jobdesc")"

try

Dim strJobDesc
strJobDesc = rsJobsearch("jobdesc") & " "
strJobDesc = Replace(strJobDesc,vbCrlf,"<br>")

Response.Write(strJobDesc)

if that doesnt work try

if isNull(rsJobsearch("jobdesc") = True then
     Response.Write(Replace(rsJobsearch("jobdesc"),vbCrlf,"<br >"))
end if

basically you cant do a Replace() if there is nothing in the field (ie "JobDesc") so its giving an error



-------------
S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .


Posted By: WookMaster
Date Posted: 09 December 2003 at 11:33am
Worked great you guys on this forum know your stuff


Posted By: MorningZ
Date Posted: 09 December 2003 at 1:40pm

btw.. you can avoid the if..then by doing:

Response.Write Replace("" & rsJobsearch("jobdesc"),vbCrlf,"<br>")



-------------
Contribute to the working anarchy we fondly call the Internet



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net