Possibility of 4 different dates, need to know latest to work out process time (1 Viewer)

rhounsome

Registered User.
Local time
Today, 21:35
Joined
Jul 16, 2001
Messages
36
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

Registered User.
Local time
Today, 21:35
Joined
Jan 30, 2001
Messages
20
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

I know a few things...
Local time
Today, 15:35
Joined
Oct 23, 2001
Messages
2,633
Would the Min() function help?

David R
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 16:35
Joined
Feb 19, 2002
Messages
43,484
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
 

Users who are viewing this thread

Top Bottom