View Full Version : Possibility of 4 different dates, need to know latest to work out process time


rhounsome
04-11-2002, 05:55 AM
I have a form with 4 date fields in for receipt of paperwork covering different sections. These all need to be selected before progressing to the next part of the form. This I have done.

Noramlly the information is submitted all at the same time but sometimes the sections arrive at different times.

I need to write a formula that picks the newest of the 4 dates and subtract the document print date to work out the process time. I am not fussed about the fact the figure will be based on a proper week rather than a working week.

For ease I have called the document received fields DATE1, DATE2, DATE3, DATE4 and the print date DATE5.

Can someone give me some help on wirting the formula. I have a rough idea i.e.

If DATE1 >= DATE2 Or DATE1 >= DATE3 Or DATE1>= DATE4 Then DATE4 - DATE1
Else
. . . . .

But surely there is a easier way.

archiecone
04-11-2002, 06:03 AM
There is a function called DateDiff. Subtract each date from the current date and use the smallest..

You can email me at archie.cone@mustangeng.com

David R
04-11-2002, 06:49 AM
Would the Min() function help?

David R

Pat Hartman
04-11-2002, 02:44 PM
Create a function in the form's module.

Public Function ProcessDays() As Integer
Dim HoldDate as Date
HoldDate = Me.DATE1
If Me.DATE2 > HoldDate Then
HoldDate = Me.DATE2
End If
If Me.DATE3 > HoldDate Then
HoldDate = Me.DATE3
End If
If Me.DATE4 > HoldDate Then
HoldDate = Me.DATE4
End If

ProcessDays = HoldDate - Me.DocPrintDt
End Function