Condensing Text fields into a Memo field - Need to retain line spa

D

Doc Don Sturgiss

I have eight lines of text, one after another, which I need to insert into a
Memo field. The first line always has content. The other liines may not, and
some may have content in one of more lines, skip one of more lines and then
have more content.

I need to have the contents of the Memo field look just like the original
Text field lines, which may have either nothing in the line, a short line, or
a long line (to the end of the field).

Thus if the first line is long, the second line short, the third line long,
the fourth and fifth lines blank and the sixth line long, I will get the
display from the Memo field to dupllicate that.

The problem I am having is that I don't know how to insert a line-feed after
appending the data from each line which would give me the desired result.

Manually, I would (in the case above) just enter the long first line, let
the text wrap automatically to make the short second line, hit <Enter> to go
to the third line and enter it, hit <Enter> three times to finsh that third
line and skip the fourth and fifth lines, and then enter the sixth line and
then hit <Tab> to leave the field. That would give me the same appearance as
was there in the eight separate text lines from before.
 
D

Doc Don Sturgiss

I forgot to mention that this is for client's Access '97 database, being
converted to a new format, so "vbcrlf" command I have seen used in this forum
does not work (see "Memo field update", third Stewart Tanner reply.

Also, I am using an update query to take the contents of tthe individual
description lines (fields) and appending them to the Description memo field.
That doesn't work.

I don't want to have to resort to ending each line with "-=< end of liine
 
B

Brendan Reynolds

vbCrLf works fine in Access 97, but it only works in code. If you're doing
this in a query, use Chr$(13) & Chr$(10). For example ...

UPDATE TargetTable SET TargetField = SourceField1 & Chr$(13) & Chr$(10) &
SourceField2 & Chr$(13) & Chr$(10) & SourceField3

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
D

Doc Don Sturgiss

Deaar Brendan,

I had laready tried the "& CHR#(13) & CHR$(10)" to attempt to get a CR-LF
but that didn't work . What did finally turn out to work is a double CR-LF.
The first one jsut acts like a trigger (i.e. "Get ready for a CR-LF") The
second actually gives a linefeed. Of course, this means that thee endo fo
each blank line is a CR-LF CR-LF. And two blank lines double this, for four
CR-LFs in a row.

Since the first CR-LF acts as a "shifter", the next three CR-LFs act as real
CR-LFs and each gives an add'l linefeed. So multiple empty lines between
lines with data in them give more than one add'l linefeed for each empty
line, specfically, two empty lines give three linefeeds, three empties give
five linefeeds, etc. Who'd a thought?

And if a CR-LF is placed at the end of every non-empty line, each line
breaks at its end, where it is supposed to.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top