Check Date falls within date range

Hi there,

This should be a simple one for some of you notes guru’s, but has left little ole my stuck!

My Form has 3 editable date fields; Issue Start Date, Issue End Date, and Issue Action Date. The Issue Action Date must fall between the Start/End date parameters.

I need a piece of script that I can use in the Query Save event to validate the above before users can save the document.

Nicole

Subject: Check Date falls within date range

Here are some blocks of code that I have used to do this task.

Setup my two dates (Start and End)

Set vDueDateStart = New NotesdateTime(sess.getEnvironmentString(“DueDateStart”))

Set vDueDateEnd = New NotesdateTime(sess.getEnvironmentString("DueDateEnd"))

Read my variable date into tReportDate

Set tReportdate = New notesdatetime(Cstr(doc.Reportdate(0)))

	dif1 = vReportDateStart.TimeDifference(tReportDate)

	dif2 = vReportDateEnd.TimeDifference(tReportDate)

	If dif1<=0 And dif2>=0 Then Goto check2 Else Goto skipit

check2 was another set of checks, and skipit means that the data did not conform to my parameters.

I am sure you could adapt this code to suit your purposes.

Subject: Pretty easy w/ @Formulas or LotusScript

d1 = doc.IssueStartDate(0)d2 = doc.IssueEndDate(0)

d3 = doc.IssueActionDate(0)

If d3 < d1 Or d3 > d2 Then

 Msgbox "Your Error"

 Continue = False

End If

Or in @Formulas in an Input Validation Formula:

@If(IssueActionDate < IssueStartDate | IssueActionDate > IssueEndDate; @Failure(“Your Error”); @Success)