How can I check whether the document is already opened?

How can I check whether the document is already opened? I want to avoid the users starting a new edit session by pressing the buttom without closing down the first one first.

Subject: Open document

Is this what you mean?

Dim uiws As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = uiws.currentdocument

If Not uidoc Is Nothing Then

msgbox "Document is open"

End If

Subject: How can I check whether the document is already opened?

Hi Leen,

     Thanks for your responase.But thats not what i wanted..When i open a document and if myself is trying to open the same document ,then it should prompt me some message.