LOTUSSCRIPT/COM/OLE CLASSES
Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Set db = session.CurrentDatabase Dim dc1 As NotesDocumentCollection Dim dc2 As NotesDocumentCollection Dim doc1 As NotesDocument Dim doc2 As NotesDocument Dim message As String Dim state1 As String, state2 As String Dim searchformula1 As String, searchformula2 As String state1 = Inputbox$("First state?") state2 = Inputbox$("Second state?") searchFormula1 = {Form = "Employee" & WorkLoc = "} & state1 & {"} searchFormula2 = {Form = "Employee" & WorkLoc = "} & state2 & {"} ' Note: NOT the most efficient way to do this task, ' but it's just an example. Set dc1 = db.Search(searchFormula1,Nothing, 0) Set dc2 = db.Search(searchFormula2,Nothing, 0) Call dc1.Intersect(dc2) If dc1.count = 0 Then message = "No employee documents found for both " & state1 _ & " and " & state2 Messagebox message, MB_OK, "No documents" Else Set doc1 = dc1.getFirstDocument message = "" While Not doc1 Is Nothing message = message & { } & doc1.GetItemValue( "Name" )(0) Set doc1 = dc1.getNextDocument(doc1) Wend Messagebox Mid$(message, 2), MB_OK, "Employees in " & state1$ & " and " & state2$ End If End Sub