Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Switiching a doc to read only?

Status
Not open for further replies.

plc001

Technical User
Dec 23, 2002
15
US
I have a form that allows the users to submit a request. Once the user submits a request, I would like to change the request to be on a view only status, that way they can not change it. Is there an easy way to do this?

Thanks!
 
Put a field on your document called "Status".

Put the following code into the QueryModeChange event on your form:

Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
If not source.editMode Then
If Source.Document.Status(0) = "Closed" Then
Messagebox "You may not edit a closed document."
continue = False
End If
End If
End Sub

Write some code into your save button or into the status field that updates the status field to closed when the document is saved.

When a user opens the document and tries to edit it the QueryModeChange event will fire, check the status field and not allow the mode change to continue if the status of the document is closed.

hope this helps!
 
In addition, stick the same idea into QueryOpen or PostOpen to stop them doing Ctrl - E from the view
 
Thanks that worked, but can I allow a UserRoles to still edit the doc like [ADMIN]?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top