Link to home
Create AccountLog in
Avatar of HKFuey
HKFueyFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Access text box to display Memo field

I have a form with a text box displaying a memo field. If I append to the field thus: -

'Old Text' & 'New Text' & vbCr & vbLf

The resulting text is just a long string with no line feeds, if I copy to Word the line feeds display properly: -

'Old Text

New Text'

Does anyone know how to get the text to display properly on the form?
Avatar of IrogSinta
IrogSinta
Flag of United States of America image

How about:
'Old Text' & vbcrlf & 'New Text'
Avatar of HKFuey

ASKER

I tried that it gives the same result, I have also tried:
'Old Text' & Chr(13) & Chr(10) & 'New Text'

This displays as 'Old Text'  'New Text' I really want:

'Old Text

New Text'
vbcrlf will work in VBA.

If you are working with a control source in a property sheet however, you need the actual character codes.

Double check that, using the = sign ... It works for me in Access 2007:

="asjkdjfkjsdfjksdf" & Chr(13) & Chr(10) & "klskdlfksldkfksdf"
SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of HKFuey

ASKER

Hi Mbizup,
If I print the results in the Access Immediate window I get a nice neat list with a new line for each comment.

The text box just displays a long messy string. The text box is bound to the data, could this be the problem?
What is the control source, and how are you setting the value of the field ?

Are you using VBA?

Or setting it throught the property sheet?


(Post exactly the code you have, or upload a screen shot of the property sheet if needed).
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Rich Text will work if you need to keep other formatting... but you might  have to use HTML tags instead of the character codes:

="asjkdjfkjsdfjksdf" & "</p>"  & "klskdlfksldkfksdf"
Avatar of HKFuey

ASKER

I had changed it to Rich Text while trying to get it to work, all's now well! Thanks for the help.

Andy