FieldSetText method

Hello,

I have the following code in the QuerySave event of a form (SendTo is a text field allowing multiple values with comma as seperator and not calculated):

Sub Querysave(Source As Notesuidocument, Continue As Variant)

Dim stEtat As String, stAutoValid As String, stValideurs As String, stOrdonnateurs As String, stRecipients As String, stPayeurs As String

Dim vRcpt As Variant, vValideurs As Variant, vOrdonnateurs As Variant, vPayeur As Variant

Dim iRcptCount As Integer

Dim nmUser As NotesName



Call Source.Refresh



Set nmUser = New NotesName(Session.UserName)

stEtat = Source.Document.GetItemValue("EtatDemande")(0)

stAutoValid = Source.Document.GetItemValue("AutoValid")(0)

stRecipients = Source.FieldGetText("SendTo")



If stRecipients = "" Then

	stRecipients = nmUser.Abbreviated

Else

	vRcpt = Split(stRecipients, ",")

	iRcptCount = Ubound(vRcpt) + 1

	vRcpt(iRcptCount) = nmUser.Abbreviated

	vRcpt = Arrayunique(vRcpt, 5)

	stRecipients = Join(vRcpt, ",")

End If



Call Source.FieldSetText("SendTo", stRecipients)

Call Source.Document.ReplaceItemValue("EtatDemande", stEtat)

End Sub

There’s no compile/runtime error but the SendTo field remains empty. With the debugger on, I checked that vRcpt and stRecipients are updated correctly, but when it calls FieldSetText, SendTo ain’t updated.

Subject: FieldSetText method

is this in the Memo form? If so, try EnterSendTo instead of SendTo

Subject: RE: FieldSetText method

Helo Paul,

No it’s not the memo form, it’s a custom form in a database I’ve created.

Subject: RE: FieldSetText method

You said that SendTo is an editable text field, but is it actually visible when you run this code? For FieldSetText to work the field must not be hidden, inside a collapsed section or on a non-active tab of a tabbed table.

You could simply write that field using the backend document, anyway:

Call Source.Document.ReplaceItemValue(“SendTo”, stRecipients)

No need to join stRecipients into a string than, just use the array (or plain string) as it is.

Subject: RE: FieldSetText method

The answer was under my nose, but I didn’t see it… Thanks