johnhardy
asked on
Invalid use of Null Replace
Hello Experts,
I have a results page where I want to display memo fields with the original formatting, (Line spacing)
The code below works OK until it comes to an empty field.
<%
'replace spaces and put breaks
strText = (rsUpdate.Fields.Item("Ski llsRequire d").Value)
strText = replace(strText,VbCrLf,"<b r>")
response.write strText
%>
Then I get this error.
Invalid use of Null: 'Replace'
/britishconsultancy/Assign -COMPLETED /print.asp , line 755
Can anyone tell me what code to use to avoid the error please.
Thanks
John
I have a results page where I want to display memo fields with the original formatting, (Line spacing)
The code below works OK until it comes to an empty field.
<%
'replace spaces and put breaks
strText = (rsUpdate.Fields.Item("Ski
strText = replace(strText,VbCrLf,"<b
response.write strText
%>
Then I get this error.
Invalid use of Null: 'Replace'
/britishconsultancy/Assign
Can anyone tell me what code to use to avoid the error please.
Thanks
John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Rochie for that information.
The code I altered above does seem to be working OK with empty fields.
The code I altered above does seem to be working OK with empty fields.
Yes, I just included that little snippet for general reference if anyone else needs help. Your method is simply forcing the NULL to be converted to text by adding a blank string to it. I'm not too sure how reliable that would be should it need expanding further - but at least it works for you!
ASKER
Thanks its away great to have the best advice
Regards
John
Regards
John
ASKER
I hope it helps someone else
Thanks
John
<%
'replace spaces and put breaks
strText = (rsUpdate.Fields.Item("Pur
strText = replace("" & strText,VbCrLf,"<br>")
response.write strText
%>