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> </div>".
I tried the 'text' property, but that returns the same thing.
Ideas?
Thanks!
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> </div>".
I tried the 'text' property, but that returns the same thing.
Ideas?
Thanks!
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> </div>".
But i want to detect when the field is empty or has just a space in it...
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
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 = " "
MyRTB.Text = Replace (MyRTB.Text, strNBSP, "")
Const strNBSP = " "
MyRTB.Text = Replace (MyRTB.Text, strNBSP, "")
ASKER
not sure I follow you... what is "selRTF"?
selRTF is used when you want to replace the selected portion of text in a RTB.
ASKER
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
this function is exactly what I was looking for.
And what about just one space ?
mx