I’m working on agent that simply sends out a email based on a search formula and I’m getting the error “No Form Associated with Document”. Can anyone see my error?
Thanks in advance.
Declarations
Dim s As NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim emaildoc As NotesDocument
Dim collection As NotesDocumentCollection
Sub Initialize
Set s = New NotesSession
Set db = s.CurrentDatabase
searchFormula$= "Form = ""Employee"""
Set collection = db.Search(searchFormula$,Nothing,0)
' For each document send a reminder to the appropriate person
Dim person As String
For i = 1 To collection.Count
Set doc = collection.GetNthDocument(i)
Set emaildoc = db.createdocument
rawperson= doc.getitemvalue("Employee")
person =Cstr(rawperson(0))
'Msgbox(person)
person2 = "Charles McCutchen"
emaildoc.Form = "Reminder"
emaildoc.Subject="Reminder to fill out weekly timesheet"
Set emaildoc = db.createdocument
emaildoc.Send True, person2
Next
End Sub