Domino Code Fragment

Code Name*
Check to see if this is an existing ID to allowing user to continue
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.145.105.108
Description*
Check ID field to ensure that the ID being eneterd does not already exist.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
Sub Exiting(Source As Field)
    Dim session As New NotesSession
    Dim ws As New NotesUIWorkspace
    Dim db As NotesDatabase
    Dim dateTime As NotesDateTime
    Dim uidoc As NotesUIDocument
    Dim collection As NotesDocumentCollection
    Dim sCheckID As String
    Dim search As String
    Set uidoc = ws.CurrentDocument
    Set db = session.CurrentDatabase
   
    ' Here we check if this is a new document
    If uidoc.IsNewDoc Then
         sCheckID = uidoc.FieldGetText( "IDNum" )
         Set collection = db.FTSearch( sCheckID, 0 )
         If collection.count > 0 Then
              Call uidoc.FieldSetText ( "IDNum", "")
              Call uidoc.GotoField( "IDNum")
              Msgbox "This ID already exist", 16, sCheckID + "Please input a different ID"
         End If
    End If
End Sub