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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formating Text within a Text Box 3

Status
Not open for further replies.

pparadis

MIS
Dec 5, 2000
22
0
0
US
Please Help. I'm trying to format text within a text box. I'm making a recordset from a query and then pulling a definition fields from that query and adding them together. I wanted to put a 'return' between each definition. Is there some kind of return statement that can be used within a textbox? Thanks
 
str1 & chr(10)& chr(13) & str2 prints

str1
str2

Is this what you meant by 'Return' ?? (I call the enter key the return key)
 
Yeah I think we're on the same page. After I pull one of the definitions to be displayed in the text box, I want to skip to a new line before I movenext and pull the next record(definition) to be displayed in the same text box. for example say below are two definitions that are in the recordset:

A small pager that has multiple features for keeping time.
A small pen that can function as a phone.

I want the text box to show the data like it is above. When one definition ends, it moves to the next line and prints the next definition.

Currently it displays them in the text box like this:
A small pager that has multiple features for keeping time.A small pen that can function as a phone.

Here is the code:

Sql = "Select * From Descriptions"

Set Rs = db.OpenRecordset(Sql)

Do While Not Rs.EOF
With Rs
It = It + !Description
Rs.MoveNext
End With
Loop



Me.Text0 = It

Thanks. Hope this is more clear
 


Change It = It + !Description
to It = It + chr(10) + chr(13) + !Description
 
Using that, the first line in the textbox is skipped, but in the other places it just shows two boxes followed by the next description. Here's what I get:
<This lline was skipped>

The United States of America is located in North American and is currently lead by President George Bush.

kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk

Joe will be in Australia until December.

Kangaroos

The Olympics were in Australia.

Hey
 
Strange,

this works


Dim mystr
mystr = &quot;1&quot; & Chr(10) & Chr(13) & &quot;2&quot;
MsgBox mystr

Let me chew on it.
 
Thanks for helping Databaseguy. I tried your code in my form and it worked using the message box. I tried displaying the same result in the text box and it gave me the two boxes again. Strange. Thanks again!
 
Hi!

This works for me:

It = It & vbnewline & !Description

hth
Jeff Bridgham
 
Very helpful - works as described
I've been lookin for this guy for way to long
thx
RGB
 
Weird.

vbnewline is just chr(13).

MichaelRed
mred@att.net

There is never time to do it right but there is always time to do it over
 
I replaced all my &quot;chr(13) & chr(10)&quot; by a simple &quot;vbCRLF&quot;
 
The reason you were getting blank lines is because you start off with

It = It + chr(10) + chr(13) + !Description

This means the first time the code goes through this call its going to Add &quot;It&quot; which is blank so far, and a linkfeed then the description. But subquential lines will work fine. You could have used some kind of counter to check to see if this is the first line and if so leave off the chr(10) & chr(13).

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top