Reminder Agent: Getting "Object Variable not set"
Posted on 2004-11-25
I'm developing a training resources database. There is a form and a hidden view called "Courses2". TThe fields, from the form, in the view used are:
All fields are text except for Act_Start_Date which is Date/Time. All are editable.
I've written a scheduled agent that is supposed to run once a day on documents in a view. The agent checks all the documents in the view and checks that the date in Act_Start_Date is 30 days before todays date. If it finds a document it mails the employee and the TL (team leader).
When I run the agent manually I get "Object Variable not set".
My code is
Dim s As New notessession
Dim db As notesdatabase
Dim due As notesview
Dim maildoc, viewdoc As notesdocument
Dim daten As Variant
Dim duedate As String
Dim TL As String
Dim Employee As String
Do Until viewdoc Is Nothing
If daten=(duedate-30) Then
Dim rtitem As New notesrichtextitem(maildoc, "Body")
maildoc.Subject="Training Reminder - 1 month to go"
Call rtitem.AppendText( "Training in a month's time for"& Employee)
Call maildoc.send(False, maildoc.SendTo(0))