Text box behavior?

J

John Clark

Help?

I have text fields in my database table and the fields have LF (ASCII
10) characters where new lines should start within the content of the
field - is there a way to get a text box on an Access form to treat
these characters as if they were actually CR/LF pairs and display the
content in the text box such that it starts a new line when it
encounters an LF character?

If not, does someone have the syntax of an update query that would
replace the LF characters within a text field with CRLF pairs?

Thanks,
-jdc
 
D

Douglas J. Steele

You could set the ControlSource for the text boxes to

=Replace([MyField], Chr(10), Chr(13) & Chr(10))

instead of just having it as ControlSource, but then the text box won't be
updatable.

If you need it to be updatable, you'll need to update the table using

UPDATE MyTable
SET MyField = Replace([MyField], Chr(10), Chr(13) & Chr(10))

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Help?

I have text fields in my database table and the fields have LF (ASCII 10)
characters where new lines should start within the content of the field - is
there a way to get a text box on an Access form to treat these characters as
if they were actually CR/LF pairs and display the content in the text box
such that it starts a new line when it encounters an LF character?

If not, does someone have the syntax of an update query that would replace
the LF characters within a text field with CRLF pairs?

Thanks,
-jdc
 
J

John W. Vinson

If not, does someone have the syntax of an update query that would replace the LF characters within a text field with CRLF pairs?

UPDATE tablename
SET fieldname =
REPLACE([fieldname], Chr(10), Chr(13) & Chr(10))
WHERE fieldname LIKE "*[!" & Chr(13) & "]" & Chr(10) & "*";


John W. Vinson [MVP]
 

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