Hi Rob,
ich habe meinen Code nochmals am Ende geändert:
---
Sub Click(Source As Button)
Dim session As New notessession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim docUNID As String
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument 'get the frontend doc
Dim backendDoc As NotesDocument
Set backendDoc = uidoc.Document 'get the backend doc
Call uidoc.save()
Call uidoc.close
Dim rtDocLink As NotesRichTextItem
Dim docPick As New NotesDocument( db )
Dim vStringArray As Variant
Dim tname As String
Dim comma As Integer
Dim ttel, tdw, tfax, tmail As notesitem
vStringArray = ws.PickListStrings(PICKLIST_NAME, False, db.Server, "names.nsf", "($VIMPeople)", "InternetAddress", "Bitte wählen Sie aus", 1, "")
If Isempty(vStringArray) Then Exit Sub
comma = Instr(vStringArray(0),",")
If comma > 0 Then
tname = Fulltrim(Strrightback(vStringArray(0),",")) + " " + Fulltrim(Strleftback(vStringArray(0),","))
Else
tname = Fulltrim(vStringArray(0))
End If
Set nab = New NotesDatabase(db.server , "names.nsf")
If nab.IsOpen Then
Set view = nab.GetView("($Users)")
Set tdoc = view.getdocumentbykey(tname)
Set tmail = tdoc.Getfirstitem("InternetAddress")
Set ttel = tdoc.Getfirstitem("OfficeNumber")
Set tdw = tdoc.Getfirstitem("OfficePhoneNumber")
Set tfax = tdoc.Getfirstitem("OfficeFAXPhoneNumber")
Call backendDoc.ReplaceItemValue("DVB_Name", tname)
Call backendDoc.ReplaceItemValue("tmp_DVB_Name", Evaluate("@Name([CN]; DVB_Name)", note))
Call backendDoc.ReplaceItemValue("DVB_Mail", tmail.Text)
Call backendDoc.ReplaceItemValue("DVB_Tel", tdw.Text)
Call backendDoc.ReplaceItemValue("DVB_Fax", tfax.Text)
Call backendDoc.ReplaceItemValue("DVB_Kunde_Tel", ttel.Text)
backendDoc.RemoveItem( "Link" )
backendDoc.CreateRichTextItem( "Link" )
Set rtDocLink = backendDoc.GetFirstItem( "Link" )
Call rtDocLink.AppendDocLink( tdoc, "DocLink" , "Details")
docUNID = backendDoc.UniversalID
Call backendDoc.Save( True, False, True )
backendDoc.saveoptions = "0"
Call uidoc.Close
Set backendDoc = db.GetDocumentByUNID( docUNID )
Set uidoc = ws.Editdocument( True, backendDoc )
'Call uidoc.Refresh( True )
'Call uidoc.GotoField( "Kunde_Tel" )
Set backendDoc = uidoc.Document
backendDoc.saveoptions = "1"
End If
End Sub
---
Es funktioniert nun auch soweit, allerdings bei der 3. letzten Zeile: backendDoc.saveoptions = "1"
bekomme ich ne Fehlermeldung:
"Object Variable not set!"
Im Debugger ist die Variable backendDoc leer, nachdem die Zuweisung: Set backendDoc = uidoc.Document erfolgt ist.
Woran kann dieses liegen ?
Gruss JoFa