Existing line breaks in textbox not showing (1 Viewer)

Freshman

Registered User.
Local time
Tomorrow, 00:20
Joined
May 21, 2010
Messages
419
Hi there,
I have a textbox based on existing data from a table (Long Text field data type).
I don't have control over the input of the data which is done via a website but it appears to have linebreaks because if I copy and paste the exact text into Notepad, it shows with linebreaks, but in the Textbox in Access it shows as one contious line which is difficult for the User to read.
See image attached.
I would like the Textbox to also show the same format. Rich text did not help and I have Shrink and Grow set to True.
To test I created a command button to open NotePad and copy and paste the text into it which displays 100% as explained above.

I know I can re-format the text by looping through the charactes to insert linebreak (vbCRLF) but due to the complexity of the text it would be a big mission to do plus I know the linebreaks are there, so maybe there is a shortcut to display them.

Any ideas?

Thanks
 

Attachments

  • Screenshot_1.jpg
    Screenshot_1.jpg
    69.3 KB · Views: 45

CJ_London

Super Moderator
Staff member
Local time
Today, 22:20
Joined
Feb 19, 2013
Messages
14,746
I know I can re-format the text by looping through the charactes to insert linebreak (vbCRLF)

just use the replace function.

identify the ascii of the break chars (one time exercise - loop through some example text character by character and debug.print the ascii value)

then incorporate into your import routine

mytext=replace(myText,chr(??), vbcrlf)

Alternative is to try the plaintext function

mytext=plaintext(mytext)
 

Freshman

Registered User.
Local time
Tomorrow, 00:20
Joined
May 21, 2010
Messages
419
Using the replace option is not that simple. The linebreaks is a bit more complex to do since I will have to check for "/20" and then revert back a few char to check for a space to cater for single or double digit days/month etc. So a mission.
BUT you second option worked like a charm :)
Firstly I did not know the plaintext function until today and secondly I find it strange that it does not work without it since by default a Textbox is already set to plaintext but as I said bottomline is your suggestion work 100% for me.
So all sorted in 3 seconds flat :)
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 05:20
Joined
May 7, 2009
Messages
16,881
you can use Microsoft Form 2.0 Textbox, you can control whether
the Text will wrap or not.
 

Freshman

Registered User.
Local time
Tomorrow, 00:20
Joined
May 21, 2010
Messages
419
Ahh - very nice - that also works thanks. With it I could clearly see the linebreak char in the text which was previously hidden.
The WordWrap was set to 'Yes' and had not effect, but setting the Multiline to 'Yes' worked 100%. Result displays the same as CJ_London's suggestion.
Thanks so much to both of you for such a simple solution.
 

Users who are viewing this thread

Top Bottom