Link to home
Start Free TrialLog in
Avatar of terpsichore
terpsichore

asked on

RTF memo field: what is text value?

Hopefully an easy one - I am trying to do certain things when the value of a memo field is empty (if trimmed).
There is just a space in a field, so this code should be invoked, but it is not doing that, since the value of the field is, in fact, "<div>&nbsp;</div>".

I tried the 'text' property, but that returns the same thing.

Ideas?
Thanks!
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

What is the code you have ?

And what about just one space ?

mx
Avatar of terpsichore
terpsichore

ASKER

I'm just displaying the memo field on a form. It displays only a single space, nothing else (e.g., when I highlight contents, or when I type text and replace with just a space). When I put a breakpoint in the afterupdate and query the value, it says "<div>&nbsp;</div>".
But i want to detect when the field is empty or has just a space in it...
You can check for text only. Insert the string in your RTF and read plain text only and check for empty string.

RTB.SelRTF = myString
If Trim(RTB.Text) = "" Then
    'Do whatever you need.
End If
If you want to remove the non-btreaking space you should be able to do something like this,

Const strNBSP = "&nbsp;"

MyRTB.Text = Replace (MyRTB.Text, strNBSP, "")
not sure I follow you... what is "selRTF"?
selRTF is used when you want to replace the selected portion of text in a RTB.
I'm using Access 2010, it says that property is not available.
Well I guess you don't need it since I assume you are not manually selecting any portion of the text.
ASKER CERTIFIED SOLUTION
Avatar of terpsichore
terpsichore

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
this function is exactly what I was looking for.