Date craziness

I want to use the lesser of two dates to compare to todays date to see if it is more than 10 days overdue. Seems simple enough. I have script that I’ve pieced together from here and there finally working. But since I can’t append my “CheckDate” to a messagebox (even using Cstr) I feel I’m missing something. I get a type mismatch if I try to append Cstr(CheckDate) to a messagebox text.

So I’m searching and searching getting more and more confused on how to handle dates. It seems as if there are so many options … is there a rule of thumb to use for backend classes? Maybe this code is set up all wrong!? Should I not be using NotesItem? Or NotesDateTime?

Any advice or way to simplifiy this in my mind would be greatly appreciated!

Sub Initialize

'...

Dim item As NotesItem

Dim CheckDate As NotesDateTime 		

Dim tempToday As New NotesDateTime(Today)	

'...



While Not (Doc Is Nothing)		

	'Use the eariler of the two dates to proceed...

	If doc.PropMail(0) <  doc.PropEff(0) Then					

		Set item = doc.GetFirstItem( "PropMail" )

		Set CheckDate = item.DateTimeValue			

	Else 

		Set item = doc.GetFirstItem( "PropEff" )

		Set CheckDate = item.DateTimeValue			

	End If

	

	Call CheckDate.AdjustDay(+10)	

	

	'Check if date is more than 10 days overdue from today 

	difference& = CheckDate.TimeDifference( tempToday ) 

	

	If difference& > 0  Then

		Msgbox "Not Past Due Yet!"  

	Else

		Msgbox "Past Due! "  

	End If

	

	Set doc = view.getnextdocument(doc)

Wend

End Sub

Subject: Date craziness

Not sure if this helps but the snippet of code below using a Notes date field like your PropMail however I use a Cdat on it to do my comparisons. Try using this on a temp variable then Cstr it to see if the debugger shows it as a string type. Place several debug lines before where your code is failing too see how he type is (or isn’t being manipulated.)

Set contractDateTime = New NotesDateTime( " " )

Call weekDateTime.AdjustMonth( -6 ) 'age today back by 8 months.

contractDateTime.LSLocalTime = Cdat(doc.ContractEffectDate(0)) ’ Effect Date field reflects inception or effect date.

If weekDateTime.TimeDifference( contractDateTime ) > 0 Then

Subject: Date craziness