473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Text box question

This seems like it should be easy, but I can't find the answer anywhere.
I need to combine text fields from several different records into one
text box for display purposes. Here's the code I'm using: (rstTable is
a recordset)

do until rstTable.EOF
txtBox.text = txtBox.text & rstTable!Description & chr(13)
rstTable.MoveNext
Loop

The problem is the text box ignores the carriage returns. I get all the
text, but I need each record to be separated by at least one carriage
return, and right now the text runs together. I've tried using chr(10),
several constants (I don't remember exactly what they are, something
like abNewLine or abCrLf) but they are all ignored.

I can type in the texbox and enter carriage returns, but not when I'm
loading data from the database. I'm sure there's a simple answer, but I
can't find it! Thanks for the help.

Paul
Nov 13 '05 #1
4 2941
ACCESS uses the combination of carriage return and line feed for a new line
(Chr(13) & Chr(10). This differs from some other MS Office software.

do until rstTable.EOF
txtBox.text = txtBox.text & rstTable!Description & chr(13) & Chr(10)
rstTable.MoveNext
Loop
--

Ken Snell
<MS ACCESS MVP>

"Access User" <no************@somewhere.com> wrote in message
news:42***********************@visi.com...
This seems like it should be easy, but I can't find the answer anywhere. I
need to combine text fields from several different records into one text
box for display purposes. Here's the code I'm using: (rstTable is a
recordset)

do until rstTable.EOF
txtBox.text = txtBox.text & rstTable!Description & chr(13)
rstTable.MoveNext
Loop

The problem is the text box ignores the carriage returns. I get all the
text, but I need each record to be separated by at least one carriage
return, and right now the text runs together. I've tried using chr(10),
several constants (I don't remember exactly what they are, something like
abNewLine or abCrLf) but they are all ignored.

I can type in the texbox and enter carriage returns, but not when I'm
loading data from the database. I'm sure there's a simple answer, but I
can't find it! Thanks for the help.

Paul

Nov 13 '05 #2
I thought I tried that, but I tried so many things I can't be sure.
I'll give it a try in the morning. Thanks.

Ken Snell wrote:
ACCESS uses the combination of carriage return and line feed for a new line
(Chr(13) & Chr(10). This differs from some other MS Office software.

do until rstTable.EOF
txtBox.text = txtBox.text & rstTable!Description & chr(13) & Chr(10)
rstTable.MoveNext
Loop

Nov 13 '05 #3
You can also use vbNewLine..
txtBox.text = txtBox.text & rstTable!Description + vbNewLine
(I use the + rather than & so that if it is a null entry (no description) I
don't get two empty lines)

HTH

"Paul Pentz" <pp****@visi.com> wrote in message
news:42***********************@visi.com...
I thought I tried that, but I tried so many things I can't be sure. I'll
give it a try in the morning. Thanks.

Ken Snell wrote:
ACCESS uses the combination of carriage return and line feed for a new
line (Chr(13) & Chr(10). This differs from some other MS Office software.

do until rstTable.EOF
txtBox.text = txtBox.text & rstTable!Description & chr(13) & Chr(10)
rstTable.MoveNext
Loop


Nov 13 '05 #4
I didn't try using +, but I know I tried vbNewLine, and it didn't work.
I ended up using a variable first, then copying the variable to the
text box. I'm new enough to Access that it doesn't make any sense to
me, but it worked. Here's what I did:

txtVariable = txtVariable & rstTable!Description & chr(13) & chr(10)

then when the loop finished...

txtBox.text = txtVariable

If someone can explain to me why that made a difference, I'd sure like
to know!

Paul
Mal Reeve wrote:
You can also use vbNewLine..
txtBox.text = txtBox.text & rstTable!Description + vbNewLine
(I use the + rather than & so that if it is a null entry (no description) I
don't get two empty lines)

HTH

"Paul Pentz" <pp****@visi.com> wrote in message
news:42***********************@visi.com...
I thought I tried that, but I tried so many things I can't be sure. I'll
give it a try in the morning. Thanks.

Ken Snell wrote:
ACCESS uses the combination of carriage return and line feed for a new
line (Chr(13) & Chr(10). This differs from some other MS Office software.

do until rstTable.EOF
txtBox.text = txtBox.text & rstTable!Description & chr(13) & Chr(10)
rstTable.MoveNext
Loop


Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Randell D. | last post by:
Folks, I'm still learning javascript - I've invested in a couple of books and reading online as much as possible. I'm pretty sure what I am suggesting is possible though I'm trying to weigh up...
11
by: Yeah | last post by:
I have a multiple choice quiz where I would like to use CSS to change the color of the answers upon clicking them. I would like to present the right and wrong answers up front, rather than direct...
60
by: Julie | last post by:
What is the *fastest* way in .NET to search large on-disk text files (100+ MB) for a given string. The files are unindexed and unsorted, and for the purposes of my immediate requirements, can't...
4
by: drew197 | last post by:
I am a newbie. I am editing someone elses code to make it compatible with Firefox and Safari. In IE, when you click on the proper link, a block of text is shown in a nice paragraph form. But, in...
1
by: sck10 | last post by:
Hello, I am inserting the values for radio buttons on a form into a database. There are 25 questions with 4 possible answers (see below). Is it possible to pragmatically build the radio button...
3
by: o.o.Pb.o.o | last post by:
The title is pretty vague, I couldn't agree on how to word my inquiry correctly, but I can explain. I'm writing a simple wiki script that is contained in one HTML file (yes, it's been done before)....
3
by: vtashore | last post by:
I downloaded Steve Leban's RTF2 control and it works as advertised. Good news! After reading reference material on the RTF standard codes, I have been able to write update queries to universally...
16
by: Neil | last post by:
I posted a few days ago that it seems to me that the Access 2007 rich text feature does not support: a) full text justification; b) programmatic manipulation. I was hoping that someone might...
6
by: portCo | last post by:
Hello there, I am creating a vb application which is some like like a questionare. Application read a text file which contains many questions and display one question and the input is needed...
11
by: Mike Harrison | last post by:
Hi, I have some simple HTML like this: <div id="container" style="width:100%;"> <input type="text" <input type="button" style="float:right;" value="Click here..."> </div> I want the button...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.