Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: None  |  size: 1.71 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Restricting access in Lotus Notes form
  2. Sub Querysave(Source As Notesuidocument, Continue As Variant)
  3. ' Compare the values in the form after it is saved with its original values when the document is not a new document.    
  4. Dim doc As NotesDocument
  5. Set doc = Source.Document
  6.  
  7. Dim session As New NotesSession
  8. Dim user As String
  9. user = session.CommonUserName
  10.  
  11. If newDoc Then
  12.     doc.Log_Date = Cstr(Now())
  13.     doc.Log_User = user
  14.     doc.Log_Actions = "New document created."
  15. Else        
  16.     ' Load fields value to the array
  17.     lastValues(0) = doc.QCR_Requestor(0)
  18.     lastValues(1) = doc.QCR_No(0)
  19.     ...
  20.     lastValues(31) = doc.QCR_Tracking_Info(0)
  21.  
  22. ' Compared each value in the array to see if there is any difference
  23.     Dim i As Integer
  24.     For i = 0 To 31
  25.         If lastValues(i) <> originalValues(i) Then              
  26.             Call UpdateLogFields(doc,user,i)
  27.         End If
  28.     Next
  29. End If
  30. End Sub
  31.  
  32. Sub UpdateLogFields (doc As NotesDocument, user As String, i As Integer)
  33. Dim logDate As NotesItem
  34. Dim logUser As NotesItem
  35. Dim logActions As NotesItem
  36.  
  37. Set logDate = doc.GetFirstItem("Log_Date")
  38. Set logUser = doc.GetFirstItem("Log_User")
  39. Set logActions = doc.GetFirstItem("Log_Actions")
  40.  
  41. ' a space is needed otherwise the appended text is right next to the border
  42.  
  43. Call logDate.AppendToTextList(" " & Cstr(Now()))
  44. Call logUser.AppendToTextList(" " & user)
  45.  
  46. Select Case i
  47. Case 0: Call logActions.AppendToTextList(" Requestor is changed.")
  48. Case 1: Call logActions.AppendToTextList(" QCR No is changed.")
  49.     ...
  50.   Case 30: Call logActions.AppendToTextList(" Follow Up information is changed.")
  51. Case 31: Call logActions.AppendToTextList(" Tracking information is changed.")
  52. End Select
  53. End Sub
  54.        
  55. @If(@IsNewDoc;"All";"QCR_Access");