Replace a character with line breaks

TravelTeam Posted messages 7 Status Member -  
 Anonymous user -
Hello,

In Access 2007, in a memo field, I am looking to replace * with line breaks and / with new lines.

On my end, the formula Replace([text];"*";Chr(13) & Chr(10)) only inserts a line return instead of a line break, why?
Another issue is that this line return does not appear later in the tools that use this data, while it does when manually pressing Ctrl+Enter? There is too much data to do it by hand...
And finally, what is the equivalent for the modification to a new line?

Thank you for your insights!

Configuration: Windows 7 / Chrome 52.0.2743.116

2 answers

  1. Anonymous user
     
    Good evening TravelTeam,

    Try using: vbLf instead of Car(13) & Car(10)
    If that doesn't work, try using: Chr$(13) & Chr$(10)

    This is what I usually use with VBA Excel, but it seems to me
    that it should work with VBA Access as well.

    If your problem is solved, please go to the top of the page
    to click on “Mark as resolved.”

    Otherwise, sorry: I don't have any other idea.

    Best regards. 😊
    0
    1. TravelTeam Posted messages 7 Status Member
       
      Hello Albkan,

      I couldn't manage with vbLf, and since I'm just starting out, I don't think I have the right method: Access asked me to enter a parameter value for vbLf, but when I input Car(13) & Car(10) or Chr$(13) & Chr$(10), it treats these as text...

      When trying with Chr$(13) & Chr$(10), just like with Car(13) & Car(10), only a line break is added, but not the expected newline...
      If you have any other ideas, I would appreciate it!
      Thank you for your help!
      0
      1. Anonymous user > TravelTeam Posted messages 7 Status Member
         

        Good evening TravelTeam, I had an idea; try:

        a) Replace([text];"&";vbLf & vbLf)
        b) Replace([text];"&";Chr$(13) & Chr$(10) & Chr$(13) & Chr$(10))
        c) Replace([text];"&";Chr(13) & Chr(10) & Chr(13) & Chr(10))

        Because with a single line break, it goes to the line just below, and the rest
        of the text is marked on that line: no empty line for separation!

        With 2 line breaks, it should work as you want. But this is not to be typed
        manually in a memo field, right? It needs to be put in a sub of a
        VBA module! ???? Otherwise, no other idea... ????
        0