Make sure user has only selected one doc, then create response doc.

For use in a view action. Prompts the user if no doc or more than one doc is selected. Also checks to see if the selected doc's form field is "Host". If all checks pass then the specified response document is created in edit mode.

Sub Click(Source As Button)
     Dim session As New NotesSession
     Dim workspace As New NotesUIWorkspace
     Dim db As NotesDatabase
     Set db = session.CurrentDatabase
     Dim collect As NotesDocumentCollection
     Set collect = db.UnprocessedDocuments
     If collect.count = 0 Then
          Msgbox " No Document selected!", 0 + 16
          Exit Sub
     End If
     If collect.count = 1 Then
          Dim Doc1 As NotesDocument
          Set Doc1 = collect.GetFirstDocument
          If Doc1.Form(0) = "Host" Then
               Call workspace.ComposeDocument( "", "", "formname" )
               Msgbox "You did not select a valid Assignment document, please try again.", 0 + 16
          End If
          Msgbox "You have selected more than one document, please correct and try again.", 0 + 16
     End If
End Sub

Posted by fbrefere001 on Friday October 12, 2001