Forums

ASP

This topic is locked

Something weird.

Posted 19 Aug 2002 23:09:32
1
has voted
19 Aug 2002 23:09:32 Tony Chronopoulos posted:
I have a problem. I'm trying to retrieve a value with the following method:


<pre id=code><font face=courier size=2 id=code>
&lt;% If NOT rsCompanyDetail.Fields.Item("adDetail_desc".Value = "" Then %&gt;
Description: &lt;br&gt;&lt;%=replace(rsCompanyDetail.Fields.Item("adDetail_desc".Value, VbCrLf, "&lt;br&gt;" %&gt;
&lt;% end if %&gt;
</font id=code></pre id=code>

When I run it, I get the following error:

invalid use of Null: 'Replace'

Now, the problem is that the record is not empty. If I take out the replace command, then I can see the text.

Any suggestions?

Thanks

___________________
Lunch is on me! <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>

Replies

Replied 20 Aug 2002 09:05:47
20 Aug 2002 09:05:47 Viktor Farcic replied:
First, you should check if adDetail_desc is not empty and only then use replace. Something like:
[code]
If (rsCompanyDetail.Fields.Item("adDetail_desc".Value &lt;&gt; "" Then
Response.Write(Replace(rsCompanyDetail.Fields.Item("adDetail_desc".Value, VbCrLf, "&lt;br /&gt;")
End If

Viktor Farcic
www.farcic.com
TalkZone Manager
Replied 20 Aug 2002 11:44:38
20 Aug 2002 11:44:38 Owen Eastwick replied:
Try:

&lt;% If rsCompanyDetail.Fields.Item("adDetail_desc".Value &lt;&gt; "" Then %&gt;
Description:&lt;br&gt;
&lt;% =replace(rsCompanyDetail.Fields.Item("adDetail_desc".Value, VbCrLf, "&lt;br&gt;" %&gt;
&lt;% end if %&gt;

Regards

Owen.

Multiple Parameter UD4 / Access 2000 Database Search Tutorial:
www.tdsf.co.uk/tdsfdemo
Replied 28 Mar 2006 03:30:11
28 Mar 2006 03:30:11 Simon O'Reilly replied:
Owen you are a legend!!!
I have been searching high and low for days looking for that piece of info.
May the Gods smile upon you!!

Reply to this topic