Hello,
I don’t know what is wrong in following code. I am checking if viewentrycollection is having more than 1 documents than get each entry from a view entry collection and send an email. But some how my next entry is not getting set. If I have 2 documents in view entry collection it sends an email to first entry 2 times, because getnext entry is not properly setting the next entry. Can any one guide me how to set next entry? Following is the code.
Sub Mail ( req As NotesDocument )
Dim view1 As NotesView
Dim dc As NotesDocumentCollection
Dim vc As NotesViewEntryCollection
Dim doc1 As NotesDocument
Dim entryOne As NotesViewEntry
Dim entryTwo As NotesViewEntry
Set view1 = db.GetView("lookupview")
Dim j As Integer
Set vc = view1.AllEntries
query$ = req.product(0)
j = view1.FTSearch(query$, 0 )
Set vc = view1.GetAllEntriesByKey(req.product(0))
j1 = vc.Count
If ( vc.Count >= 1 ) Then
For i = 1 To vc.Count
Set entryOne = vc.GetFirstEntry()
Set doc1 = entryOne.Document
Dim taskowner, projname As Variant
Dim email As NotesDocument
Dim docCreator As String
Set email = New NotesDocument( db )
Dim bodyItem As NotesRichTextItem
Set bodyItem = email.CreateRichTextItem( "Body" )
Call bodyItem.AppendText( "" & doc1.CMH_FName(0) & "," )
email.Form = "Memo"
email.SendTo = taskowner
email.Subject = req.Subject(0)
email.SaveMessageOnSend = False
email.Send( False )
Call req.Save( False, True )
Set entryone = vc.GetNextEntry(entryone)
Next i
End If
End Sub
Thanks
MS