Manage Learn to apply best practices and optimize your operations.

Document locking feature

This code locks the backend document while the front end document is being updated.

This code locks the backend document while the front end document is being updated. It also displays via a messagebox that the user that has locked the backend document.
Fields that will need to be created:

One text field called "CheckedOut" with a default value of ""
One text field called "DocLockEd" with a default value of  @UserName

Form events to be updated:

(Declarations)
Dim Closethis As Integer

Sub Postopen(Source As Notesuidocument)
	Dim ws As notesuiworkspace
	Dim uidoc As notesuidocument
	Set ws = New notesuiworkspace
	Set uidoc = ws.currentdocument
	
	Dim user As String
	Dim LockBy As String
	
	Dim status As String     
	status=Source.FieldGetText("CheckedOut") 
	
	Closethis = False
	If (status="Yes") Then
		LockBy=Source.FieldGetText("DocLockEd") ''''''''
		viewmess = "This Document is currently in use by --- "&_
LockBy & " --- Any Questions or problems please contact the Help Desk" Messagebox viewmess closethis = True Call uidoc.Close Exit Sub End If If source.IsNewDoc Then 'doing nothing Elseif (Source.fieldgettext ("CheckedOut") = "No") Then uidoc.editmode = True Set doc = uidoc.document Dim session As New NotesSession user = session.CommonUserName doc.DocLockEd = user doc.CheckedOut = "Yes" Call doc.Save (False, True) uidoc.Reload End If End Sub Sub Terminate Dim ws As notesuiworkspace Dim uidoc As notesuidocument Set ws = New notesuiworkspace Set uidoc = ws.currentdocument If Closethis Then Exit Sub End If uidoc.editmode = True Set doc = uidoc.document doc.CheckedOut = "No" doc.DocLockEd = "" Call doc.Save (False, True) End Sub
This was last published in April 2002

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close