Ich glaub ich check es nicht!!
So sieht das jetzt aus:
Sub Initialize
Const TitleField = "Subject"
Const LogViewName = "Log"
Const LogDateField = "LogDate"
Const LogDetailsField = "AccessLog"
Const LogFormName = "Log"
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim udoc As NotesDocument
Dim doc As NotesDocument
Dim uidoc As NotesUIDocument
Dim newdoc As NotesDocument
Dim view As NotesView
Dim LogExists As Integer
On Error Resume Next
Set uidoc = ws.CurrentDocument
Set udoc = uidoc.Document
user = Evaluate("@Name([Abbreviate]; @UserName)")
dateread = Evaluate("@Now")
readstring = user(0)
readstringdate = dateread(0)
displayall = readstring & Chr(9) & Chr(9) & " : " & readstringdate & Chr(9) &" : " & udoc.GetFirstItem(TitleField).text & Chr$(13)
Set view = s.CurrentDatabase.GetView("ViewLog")
Set doc = view.GetLastDocument
Do While Not doc Is Nothing And Not LogExists
Set temp = doc.GetFirstItem(LogDateField)
If temp.text = Format(Date$,"dd.mm.yyyy") Then
LogExists = -1
Else
Set doc = View.GetPrevDocument(doc)
End If
Loop
If Not doc Is Nothing Then
Set item = doc.GetFirstItem(LogDetailsField)
Call item.AppendToTextList(displayall)
Call doc.Save(False,False)
Else
Set newdoc = s.currentdatabase.Createdocument
newdoc.form = LogFormName
Dim PublicAccess As New NotesItem(newdoc, "$PublicAccess","1")
Dim item2 As New NotesItem(newdoc, LogDetailsField, displayall)
Dim item3 As New NotesItem(newdoc, LogDateField, Format(Date$, "dd.mm.yyyy"))
Call newdoc.Save(False,False)
End If
End Sub
robert