Type Mismatch

help!

im running a script and a type mismatch error prompted…please help me with this script.

Sub Querysave(Source As Notesuidocument, Continue As Variant)

Dim todayDateTime As Variant

Dim dueDateTime As Variant

Dim daysLeft As Long



If source.Document.HasItem("DueDate") And source.Document.HasItem("DateComposed") Then

	Call source.Refresh

	Set varDueDate = source.Document.GetItemValue("DueDate")

	Set varDateComposed = source.Document.GetItemValue("DateComposed")

	Set todayDateTime = New NotesDateTime(varDateComposed.values(0))

	Set dueDateTime = New NotesDateTime(varDueDate.values(0) )

	daysLeft = dueDateTime.TimeDifference( todayDateTime ) / 86400

	

	If source.Document.HasItem ( "Reason" ) And daysleft > 3 Then 

		Set varBody = source.Document.GetFirstItem ( "Reason" ) 

		If source.Document.HasItem ( "$Links" ) Then

			Set varLinks = source.Document.GetFirstItem ( "$Links" ) 

		End If

	Else

		Messagebox "Please attach a incident report"

		Call source.GotoField("Reason")

		Continue = False

		Exit Sub

	End If

End If

End Sub

Subject: Type Mismatch

I haven’t read your code… but have you tried running in debug mode ? That will tell you which line is failing and perhaps the reason why. I’d imagine that one of your fields either does not exist or does not contain the right data type.