huttemannw
Programmer
Hi,
The strContent parameter in the code below receives its value from a Memo field in an Access database. If I open the recordset with an adOpenForwardOnly cursor, no matter what value I send to strContent (empty string, Null, or a valid string), I get the error - Microsoft VBScript runtime error '800a005e' Invalid Use of Null - on the first Replace statement.
When I change the recordset cursor to a traversable cursor (i.e. Static, Keyset, or Dynamic), the code executes without a problem.
Is this a quirk with ADO, Access, or ASP? I have since changed the replace statements in the function to Replace(" " & strContent, "<sq>", Chr(39)). However, I would still like to know why the recordset needs a traversable cursor when comparing a value from a Memo field.
Any help would be appreciated. Thanks.
'----------------------------------------
'Decodes CRLFs and quotes for HTML display
'----------------------------------------
Function Decoder(strContent, strControlType)
If Not strContent = "" And Not IsNull(strContent) Then
strContent = Replace(strContent, "<sq>", Chr(39))
strContent = Replace(strContent, "<dq>", Chr(34))
If strControlType = "display" Then
Decoder = Replace(strContent, vbCrLf, "<br>"
Else
Decoder = strContent
End If
End If
End Function
The strContent parameter in the code below receives its value from a Memo field in an Access database. If I open the recordset with an adOpenForwardOnly cursor, no matter what value I send to strContent (empty string, Null, or a valid string), I get the error - Microsoft VBScript runtime error '800a005e' Invalid Use of Null - on the first Replace statement.
When I change the recordset cursor to a traversable cursor (i.e. Static, Keyset, or Dynamic), the code executes without a problem.
Is this a quirk with ADO, Access, or ASP? I have since changed the replace statements in the function to Replace(" " & strContent, "<sq>", Chr(39)). However, I would still like to know why the recordset needs a traversable cursor when comparing a value from a Memo field.
Any help would be appreciated. Thanks.
'----------------------------------------
'Decodes CRLFs and quotes for HTML display
'----------------------------------------
Function Decoder(strContent, strControlType)
If Not strContent = "" And Not IsNull(strContent) Then
strContent = Replace(strContent, "<sq>", Chr(39))
strContent = Replace(strContent, "<dq>", Chr(34))
If strControlType = "display" Then
Decoder = Replace(strContent, vbCrLf, "<br>"
Else
Decoder = strContent
End If
End If
End Function