Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent recording of a Richtextbox texti if the Richtextbox is blank. (has no text)

Status
Not open for further replies.

BadCook

Technical User
Sep 7, 2009
71
US
I have a group of Richtextboxs. Some have text, others don't.
My code is as follows:
For D = 1 to 15
If Richtextbox(D).text <> "" Then
Ent = Ent & D & | & Richtextbox(D).Text & |
End if
Next
What I want is a pipe delimited file I can record and then Split to get the information.
But the above code enters the D number even if the text is blank.
How can I correct this?
Any help will be appreciated
 
You could try
If Trim(Richtextbox(D).text) <> "" Then
or
If Not IsEmpty(Richtextbox(D).text) Then
 
Also, wouldn't that be:

[tt]
Ent = Ent & D & [red]"[/red]|[red]"[/red] & Richtextbox(D).Text & [red]"[/red]|[red]"[/red]
[/tt]

?

I would also examine:[tt]
Debug.Print "*" & Richtextbox(D).text & "*"[/tt]
to see why those 'empty' text boxes go thru

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top