Forums

ASP

This topic is locked

IF...THEN...not working with html memo field

Posted 25 Apr 2006 18:22:35
1
has voted
25 Apr 2006 18:22:35 Erik Piisila posted:
Hi Everyone:

I have a memo field in an Access database that contains html and special characters. If I write the value to the html page, all is well using...

<%=(Country.Fields.Item("CountryBackground".Value)%>

If I try to do a conditional statement like:

<% if (Country.Fields.Item("CountryBackground".Value) <>"" then %>
<%=(Country.Fields.Item("CountryBackground".Value)%>
<% end if %>

I get nothing to display even though the value is not empty. My best guess is that is has something to do with html or special characters that use "&"

I tried things like escape, urlencode, server.htmlencode, len...I may not have done them correctly.

How do I check to make sure a value exists before displaying to the page if there are special characters?

Any ideas?

Replies

Replied 25 Apr 2006 23:32:57
25 Apr 2006 23:32:57 micah santos replied:
try using LEN in this manner:

<%

Dim field1,recValid

field1 = objRs("memorec"

If Len(field1) = 0 Then
recValid = false
End If


If NOT recValid Then
// don't display records here
Else
// display
End If

%>

Reply to this topic