Using Chr(13) in an OnChange variable

I’m trying to set the text in a field named “TgtLog” with a variable named NewHistory. NewHistory just concatenates another variable named ReviewHistory with the username and today’s date.

I need to add a carriage return between the variable ReviewHistory and the username and date. Isn’t this what chr(13) is for?

Sub Onchange(Source As Field)

Dim ws As New NotesUIWorkspace

Dim Session As New NotesSession 

Dim uidoc As NotesUIDocument

Dim Doc As Notesdocument

Dim ReviewHistory As Variant

Dim NewHistory As Variant

Set uidoc = ws.CurrentDocument

Set doc=uidoc.Document

ReviewHistory=Doc.GetItemValue("TgtLog")

NewHistory=ReviewHistory(0) & Chr(13) & Session.CommonUserName & " on " & Today

Call uidoc.FieldSetText("TgtLog", NewHistory)

Call uidoc.refresh

End Sub

Subject: Using Chr(13) in an OnChange variable

Hi Elli,

Also try using Chr(10).

I have run into situations where Chr(13) was not giving me a Carriage Return, whereas Chr(10) was.

TJ

Subject: Using Chr(13) in an OnChange variable - Solved

Bingo! Thanks so much for your help.

Subject: Using Chr(13) in an OnChange variable

yes char(13) is used for carriage return and will work fine

just try using + instead of &

just check it out whether it works or not.

bcos + and & has the same effect when used in a msgbox function

ie. msgbox " hello Elli c Pratt" + chr(13) + " here is some text",“info”

using + or & in the function will have the same effect.

so check it out…

Subject: RE: Using Chr(13) in an OnChange variable

You can also just put a newline inside of curly or vertical bar quotes, e.g.:

something = a & {

} & b