Version check for Lotus Notes (form example)

The code below will prompt the user and not allow them to edit a document if they're using a version of Lotus Notes below R5. They will be able to open the document in read-mode. You can specify a more specific version by changing the number of characters that are scanned ( 9 characters are shown below - reading left to right). Examples of version output have been listed below in red.
LotusScript


Sub Queryopen(Source As Notesuidocument, Mode As Integer, Isnewdoc As Variant, Continue As Variant)
     
     Dim session As New NotesSession
     Dim version As String
     version = Left( session.NotesVersion , 9 )
     
     If source.EditMode = True Then
          If Not version = "Release 5" Then
               continue = False
               Messagebox "You must be running Lotus Notes version R5.0 or higher to use this utility.", 16, "Invalid Version"
          End If
     End If
     
End Sub


Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
     
     Dim session As New NotesSession
     Dim version As String
     version = Left( session.NotesVersion , 9 )
     
     If Not version = "Release 5" Then
          continue = False
          Messagebox "You must be running Lotus Notes version R5.0 or higher to use this utility.", 16, "Invalid Version"
     End If
     
End Sub


VERSION EXAMPLES:

Release 4.5.2
Release 4.6.3
Release 5.6.7
Release 5.0.0
Release 5.0.5
Release 5.0.8

Posted by fbrefere001 on Thursday April 4, 2002