Difficulty updating field

Transferring data from one document to another. I’m getting the data OK, updating the memory variable, but unable to write the new data back to the document using the call fieldsettext. Illegal Property error - any ideas

Sub Click(Source As Button)

Dim s As New notessession

Dim db As notesdatabase

Dim doc As notesdocument, doc2 As notesdocument

Dim w As New NotesUIWorkspace 

Dim uidoc As notesuidocument

Dim number As Double

Dim NextNumber As String



Set db=s.currentdatabase

Set uidoc=w.currentdocument

Set doc=uidoc.document

Set doc2=db.getdocumentbyunid( "F983950F023F7C5980256E40005FE36F") 

	

'If Not doc.editmode Then doc.editmode=True

'If Not doc2.editmode Then doc2.editmode=True



number = Cdbl(doc2.topic(0))

NextNumber = Cstr(number + 1)



Call doc2.FieldSetText( "Topic",NextNumber )

Call doc.fieldsettext("ponumber",number)

End Sub

Subject: Difficulty updating field

Fieldsettext is to be used on a Notesuidocument. You’re using it on doc2 and doc - Notesdocuments.

Use:

doc2.topic = NextNumber

doc.ponumber = number

Subject: RE: Difficulty updating field

Thanks Relim

Its running now without errors - but not updating the fields ? I can see the variable values changing in the debugger but they are not being updated in the doc.

Subject: RE: Difficulty updating field

You need to save both docs after the fields are set.

Subject: Try…

Saved = FalseFor i = 1 to 200 'Use some reasonable number

Set doc2=db.getdocumentbyunid( "F983950F023F7C5980256E40005FE36F") 



number = Cdbl(doc2.topic(0))

NextNumber = Cstr(number + 1)



doc2.Topic = NextNumber

If doc2.Save(False, False) Then  'Check and make sure no one else saved doc while you had it open

	Saved = True

	Exit For

End If

Set doc2 = Nothing

Next

If Not Saved Then number = “Error getting number”

doc.ponumber = number