Hallo,
ich habe eine Form ohne Items erstellt und folgendes Code-Beispiel bei dem Event Postopen hinzugefügt:
Sub Postopen(Source As Notesuidocument)
On Error Goto EH
Dim ns As New NotesSession
Dim ws As New NotesUIWorkspace
Dim note As NotesDocument
Dim theDate As New NotesDateTime( Now )
Set Source = ws.CurrentDocument
If Source.IsNewDoc Then
'setting the name and nate fields to the users' name and the current date/time
note.name = ns.UserName' Hier taucht die Fehlermeldung auf
Set note.date = theDate' Hier ebenfalls, wenn ich note.name auskommentiere
Source.Reload
End If
PE: Exit Sub
EH: Call raiseError("", Err, Error$, Erl)
End Sub
Es kommt dann folgende Fehlermeldung:
Object variable not set
=> Postopen 13
Weiß jemand weiter?
Liebe Grüße
Giordano
Du hast die Variable note gar nicht initialisiert, daher kommt die Fehlermeldung. Tausch mal
Set Source = ws.CurrentDocument
durch
set note = Source.Document
aus.
Source brauchst du an der Stelle nicht zu setzen, da das von Notes her schon mit initialisiert wurde. Dir fehlt die Initialisierung des Backend-Dokuments, an dem du was tun willst.