Split and field name "Illegal use of property"

Hi,

I have the following code, but it is giving me an error (as shown below). How can I set the doc.FIELDNAME?


fields = “Number,FirstName,LastName,Title,Position”

fieldList = Split(fields,“,”)

x=1

Do

res.NextRow

Set doc = db.CreateDocument

doc.Form = "DemoForm"

	

For j = 0 To Ubound(fieldList)

	doc.fieldList(j) = res.GetValue(x)  ** ERROR:  Illegal use of property **

	x = x + 1	

Next		

	

Call doc.Save(True,True)		

Loop Until res.IsEndOfData

Subject: Split and field name “Illegal use of property”

Take a look at the ReplaceItemValue method of the NotesDocument class.

Set notesItem = notesDocument.ReplaceItemValue( ItemName$, ItemValue )

ItemName$ would be fieldlist(j)

ItemValue would be res.GetValue(x)

You’ll need to Dim NotesItem as NotesItem at the beginning of your code.

Subject: RE: Split and field name “Illegal use of property”

Thanks Jerry! I will give it a go and will let you know.