Time difference or datetime range

Hi Friends

I have a field “startdate” which has start dates of a event.

i have to write a agent which sends reminder to all the participants of this event one day before the start date.

can anyone help meto write code.

Regards

simran

Subject: time difference or datetime range

Dim db_Current As NotesDatabaseDim nc_dc As NotesDocumentCollection

Dim doc_Mail As NotesDocument

Dim view_Lookup As NotesView

Dim rt_MailBody As NotesRichTextItem

Dim doc_Search As NotesDocument

Dim var_searchdate As Variant

Dim session As New NotesSession

Set db_Current= session.CurrentDatabase

Set  doc_Mail= New NotesDocument(db_Current)

Set view_Lookup = db_Current.GetView("CalendarEntry") 

var_searchdate = Today()+1

Msgbox var_searchdate

Set nc_dc= view_Lookup.GetAllDocumentsByKey(var_searchdate)

Msgbox nc_dc.Count

Set doc_Search=nc_dc.GetFirstDocument

While Not(doc_Search Is Nothing)

	str_Remdate = doc_Search.dtmStartdate(0)

	If var_searchdate=str_Remdate  Then

		Msgbox "send mail"

		doc_Mail.Form = "Memo"

		doc_Mail.subject = " My subject"

		doc_Mail.sendto= "nmsAttendees"

		Set  rt_MailBody = New NotesRichTextItem(doc_Mail,"Body")

		Call  rt_MailBody.AppendText(" Subject of the letter ............")

		Call doc_Mail.Send(False)

	Else

		Msgbox "dont send mail"

	End If

	Set doc_Search=nc_dc.GetNextDocument(doc_Search)

Wend

This is my code but the problem is i am comparing a string which i am not suppose to i have to compare dates .

please help me

Subject: RE: time difference or datetime range

Instead of using a string variable str_Remdate, you should create a NotesDateTime object or simply change the line…

If var_searchdate=str_Remdate then

to

If var_searchdate=CDat(doc_Search.dtmStartDate(0)) then

Mike

Subject: RE: time difference or datetime range

actully i need to compare dates so that if it is less then tommorows date and more than one date later meansfor example if server is down today and there is a event tommorow and server ups at 12 in night so it should send reminder in my current code it is checking only one day difference.

i want it shoudl send mail even if it is less then one day.

i hope i explained you my problem

Subject: RE: time difference or datetime range

Then use the < instead of the =

And to avoid duplication, when you are sending a reminder for a document, if it is only once reminder per document, you will then need to set a field on the document to say it has been reminded. Then make sure your code doesn;t send reminders for any documents that have that field set

Subject: RE: time difference or datetime range

I need to change the value of var_keysearchbecause it is searching documents on that bases only

Subject: RE: time difference or datetime range

There is no mention of var_keysearch in your code

Subject: time difference or datetime range

How far have you got so far?