- Restricting access in Lotus Notes form
- Sub Querysave(Source As Notesuidocument, Continue As Variant)
- ' Compare the values in the form after it is saved with its original values when the document is not a new document.
- Dim doc As NotesDocument
- Set doc = Source.Document
- Dim session As New NotesSession
- Dim user As String
- user = session.CommonUserName
- If newDoc Then
- doc.Log_Date = Cstr(Now())
- doc.Log_User = user
- doc.Log_Actions = "New document created."
- Else
- ' Load fields value to the array
- lastValues(0) = doc.QCR_Requestor(0)
- lastValues(1) = doc.QCR_No(0)
- ...
- lastValues(31) = doc.QCR_Tracking_Info(0)
- ' Compared each value in the array to see if there is any difference
- Dim i As Integer
- For i = 0 To 31
- If lastValues(i) <> originalValues(i) Then
- Call UpdateLogFields(doc,user,i)
- End If
- Next
- End If
- End Sub
- Sub UpdateLogFields (doc As NotesDocument, user As String, i As Integer)
- Dim logDate As NotesItem
- Dim logUser As NotesItem
- Dim logActions As NotesItem
- Set logDate = doc.GetFirstItem("Log_Date")
- Set logUser = doc.GetFirstItem("Log_User")
- Set logActions = doc.GetFirstItem("Log_Actions")
- ' a space is needed otherwise the appended text is right next to the border
- Call logDate.AppendToTextList(" " & Cstr(Now()))
- Call logUser.AppendToTextList(" " & user)
- Select Case i
- Case 0: Call logActions.AppendToTextList(" Requestor is changed.")
- Case 1: Call logActions.AppendToTextList(" QCR No is changed.")
- ...
- Case 30: Call logActions.AppendToTextList(" Follow Up information is changed.")
- Case 31: Call logActions.AppendToTextList(" Tracking information is changed.")
- End Select
- End Sub
- @If(@IsNewDoc;"All";"QCR_Access");