Trying to add a multivalue to the uidoc field

Hi,

I am trying to add some values to a field in ui.

The field name is being passed via a function FieldName. The user selects some names via a dialobbox. I am having a problem appending the values.

Dim item As Variant

Dim Intervenant As Variant

If workspace.DialogBox( dialogForm,True,True,False,False,False,False, “Select the doctors”, docDialog , True, False,True) Then

Doctors = docDialog.GetItemValue("DoctorNames") ‘ I have 3 names in this value right now

Set doc = uidoc.document 

Set item = doc.GetFirstItem( FieldName ) ‘ this is the field Doctors_Liste in the document that I  am trying to set

i = 0

ForAll x In Doctors

	Call item.AppendToTextList( x(i)) ‘ I get variant does not contain a container.. yet i = 0, x has Tim Smith as name and the item is initialized.

	i = i + 1

			 

.....

thanks

A.

Subject: Trying to add a multivalue to the uidoc field.

Don’t index the x variable. Since you are using a Forall there is no need to use the i variable. In fact, you don’t even need to traverse the Doctors array at all, you can just pass it directly to the AppendToTextList in one call and it will append all the values contained in it in one fell swoop.

Subject: Check out ‘doc.send’ in help

There are a couple of examples that show how to set the ‘sendTo’ field with multiple values; you should find one that works.