G
Guest
Суть цикла - беру первую запись и сраниваю ее с последующими и т.д. На 10 000 записей, ой блин, как долго работает
Сможет помочь, pls.

Код:
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
On Error Goto catch
Set db = session.CurrentDatabase
Set view = db.getview ("Contragents")
Set CollectionOfFirstDocs = view.GetAllDocumentsByKey("Да", True)
Set CollectionOfDocs = view.GetAllDocumentsByKey("Да", True)
Set FirstDoc = CollectionOfFirstDocs.getFirstDocument
While Not (FirstDoc Is Nothing)
CountOfFirm = 0
FirstCompany = FirstDoc.GetItemValue("ContractParty") ' ContractParty - в этом поле контрагент
Set Doc = CollectionOfDocs.getFirstDocument
While Not (Doc Is Nothing)
Company = Doc.GetItemValue("ContractParty") ' ContractParty - в этом поле контрагент
If FirstCompany(0) = Company(0) Then
CountOfFirm = CountOfFirm + 1
End If
Set Doc = CollectionOfDocs.GetNextDocument(Doc)
Wend
If CountOfFirm > 1 Then
Msgbox "Фирма " + Company(0) + " " + CountOfFirm + " повторений."
End If
Set FirstDoc = CollectionOfFirstDocs.GetNextDocument(FirstDoc)
Wend
Exit Sub
catch:
Msgbox Error & | in line | & Erl(), 64, |Lotus Notes (| & Lsi_info(2) & |)|
Exit Sub
End Sub