Script not working on documents that cannot be edited
Posted on 2004-08-23
I have a form and there are 2 fields - AuthorizedReader which is an Editable Readers field which allow user to enter multi users who can read only and another Authors Editable field called AuthorizedAuthor which allow user to enter multi users who can edit the document. The code below is to prevent the person who is listed in AuthorizedReader from switching to the edit mode and also display a message to let reader know that they are only allow to read.If the person who open this document is in the AuthorizedAuthor field, he/she will be able to edit the document.
But when the code below runs, it will display the message "You can read only" even when the user who open the document is one of the users listed in the AuthorizedAuthor field.
Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
Dim curdoc As notesdocument
Dim item As notesitem
Dim session As New notessession
Dim x As Integer
If Not (source.editmode) Then
For x=0 To Ubound(item.values)
If session.commonusername<>item.values(x) Then
Msgbox "You can read only!" continue=False
Elseif session.commonusername=item.values(x) Then
Need this solution urgently.