append text to the end of a textbox without removing a carriage return (1 Viewer)

MilaK

Registered User.
Local time
Today, 10:57
Joined
Feb 9, 2015
Messages
285
Hello,

I would like to append lines of text to a form bound textbox when a button is pressed.
I’m using the following code to move the cursor to the end of the text and append a line.
Code:
With Me.CommentTxt
                        .SetFocus 
                         .Value = .Value & final_citation & chr(13) & chr(10)
                        '.SelStart = Len(.Value)
 End With

Issue: the carriage return the user adds after each line is inserted gets removed each time the code is executed. The only way the carriage return is preserved, if I force save record with DoCmd.RunCommand acCmdSaveRecord. However, the user doesn’t like to press “Save Record” each time a line is inserted.
I’ve tried to suppress the save record prompt but it didn’t work.

Do you have any suggestions on how to make this work?

Thanks,
Mila
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 17:57
Joined
Jul 9, 2003
Messages
16,244
Testing your code in a sample database, I discover that if I paste the text produced into this website:-

https://www.soscisurvey.de/tools/view-chars.php

the control line feed characters are preserved in the text.

I click on the label to select the text in the text box and then hover the mouse pointer over the text and select copy.

However, If I swipe directly over the text to select it, then it loses the last control line feed characters.
 

MilaK

Registered User.
Local time
Today, 10:57
Joined
Feb 9, 2015
Messages
285
I'm not sure how this will solve the issue with pasting the text via vba code.

Thanks,

Mila
 

Users who are viewing this thread

Top Bottom