Avatar of RonniLykkeHansen
Flag for Denmark

asked on 

vba carriage return in string wont work in textbox in a ms access report


I am trying to put tree string together with carriage return, so I could have an output in a textbox with tree lines instead of one. But this seems to give me some trouble:

The output is : "line1 line2 line3"

I would have expected to see:


Code below:
    Dim line1 As String
    Dim line2 As String
    Dim line3 As String
    Dim finalstring As String
    line1 = "line1"
    line2 = "line2"
    line3 = "line3"
    finalstring = line1 & Chr(13) & Chr(10) & line2 'the two lines direct under eachother
    finalstring = finalstring & Chr(13) & Chr(10) & Chr(13) & Chr(10) 'and space between line 2 and 3
    finalstring = finalstring & line3
    Me.MSCI.ControlSource = "=" & Chr(34) & finalstring & Chr(34) 'the textbox controlssource

What am I doing wrong here ?
Microsoft AccessVBA

Avatar of undefined
Last Comment

8/22/2022 - Mon