PDA

View Full Version : Access DB memo not displaying right


Roost3r
05-11-2003, 10:49 PM
Im getting this error

Error Type:
Microsoft VBScript runtime (0x800A005E)
Invalid use of Null: 'Replace'
/gli/adminview.asp, line 14

for this code

Function viewFixed(thisString)
thisString = Replace(thisString, "&lt;", "<")
thisString = Replace(thisString, "&gt;", ">")
thisString = Replace(thisString, "?34?", chr(34))
thisString = Replace(thisString, "?39?", chr(39))
thisString = Replace(thisString, "?37?", chr(37))
viewFixed = thisString
End Function

If rs1("note1") <> "" Then
Response.Write viewFixed(rs1("note1"))
End If


note1 is a memo type in my access database... now when i try

If rs1("note1") <> NULL and rs1("note1") <> "" Then
bleah

the rs1("note1") field does not display at all even when its filled with info... also when i just remove the if statment it will display fine... but i dont want to display it if note1 is empty... im using the same function with other things in my database and it works fine... except for the memo


PLZ help
TIA

whammy
05-12-2003, 03:52 AM
Function viewFixed(thisString)
If IsNull(thisString) Then Exit Function
thisString = Replace(thisString, "&lt;", "<")
thisString = Replace(thisString, "&gt;", ">")
thisString = Replace(thisString, "?34?", chr(34))
thisString = Replace(thisString, "?39?", chr(39))
thisString = Replace(thisString, "?37?", chr(37))
viewFixed = thisString
End Function

;)

whammy
05-12-2003, 03:54 AM
P.S. This looks like another attempt at trying to recreate Server.HTMLEncode badly.

What are you trying to accomplish with this? I can surely show you a better way. It looks like you might need to use Server.HTMLEncode().

Roost3r
05-12-2003, 04:10 AM
oh please do show me a better way :p

whammy
05-12-2003, 04:21 AM
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iisref/htm/ref_vbom_seromhtenc.asp

whammy
05-12-2003, 04:21 AM
"Encoding data converts potentially unsafe characters to their HTML-encoded equivalent."