Add a new line with Visual Basic using Chr(10)

I have a very strange problem. I want to add a text to a memo-field in Microsoft Access 2003 using Visual Basic. I have always used Chr(10) without problems. But this time it is just overlooked!? I use DAO to get the text I want and then add Chr(10) and the new text. Should be strait forward. But the new text ends up next to the old text.  I tried copying the text into an editor and then there was a lineshift! Why does it not show in the memofield? Obviously the lineshift is there.

Thank you for all help!

Code:
    Dim vText As String, rs As DAO.Recordset, vDesc As String, SQL As String
    vText = Chr(10) & vPartnrOld & "." & vRevOld & " has been changed to " & vPartnrMod & "." & vRevMod & "-" & vRevDesc
    SQL = "SELECT tbl" & vTbl & "Changes.[Revision Description] FROM tbl" & vTbl & "Changes WHERE (((tbl" & vTbl & "Changes.Partnr)='" & vPartnrPro & "') AND ((tbl" & vTbl & "Changes.Rev)='" & vRevPro & "'));"
    Set rs = CurrentDb.OpenRecordset(SQL, dbOpenDynaset)
    If Not (rs.EOF And rs.BOF) Then
        vDesc = rs![Revision Description]
        vDesc = vDesc & LineChange & vText
        rs.Edit
        rs![Revision Description] = vDesc
        rs.Update
    End If
LVL 1
hke72Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Haris DulicIT ArchitectCommented:
i dont see anythign wrong but maybe you can try to move that Chr(10)  like below...

could you try it?


    Dim vText As String, rs As DAO.Recordset, vDesc As String, SQL As String
    vText =  vPartnrOld & "." & vRevOld & " has been changed to " & vPartnrMod & "." & vRevMod & "-" & vRevDesc
    SQL = "SELECT tbl" & vTbl & "Changes.[Revision Description] FROM tbl" & vTbl & "Changes WHERE (((tbl" & vTbl & "Changes.Partnr)='" & vPartnrPro & "') AND ((tbl" & vTbl & "Changes.Rev)='" & vRevPro & "'));"
    Set rs = CurrentDb.OpenRecordset(SQL, dbOpenDynaset)
    If Not (rs.EOF And rs.BOF) Then
        vDesc = rs![Revision Description]
        vDesc = vDesc & LineChange & Chr(10) &  vText
        rs.Edit
        rs![Revision Description] = vDesc
        rs.Update
    End If

Open in new window

0
hke72Author Commented:
I have already tried that. But as I said the lineshift is in the text (at least if I copy it to Word), but does not change line in my memo-textbox.
I have tried looking at the properties for the field in the form, but have not found anything.
Other ideas?
0
hke72Author Commented:
I also tested copying the text into Word and then copying it back. Then it was OK. There must be something about the textcoding.
Anyone?
0
Haris DulicIT ArchitectCommented:
can you try char(13) or combination of the 10 and 13

   * Chr(10) returns a linefeed character
    * Chr(13) returns a carriage return character
    * The two-character string Chr(13) & Chr(10) returns a Windows newline
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hke72Author Commented:
Sorry, same result!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.