On Apr 23, 6:54*am, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
Quote:
On Tue, 22 Apr 2008 14:20:05 -0700 (PDT), lyle fairfield
>
<lyle.fairfi...@gmail.comwrote:
>
LOL. This is why I always read your posts!
Especially writing:
-(Date1 Date2)
rather than
(Date1 < Date2)
is a gem.
>
-Tom.
>
>
>
Quote:
|
On Apr 22, 2:47*am,alhomam<abbas2...@gmail.comwrote:
|
>
Quote:
Quote:
|
i have a table that has the two fileds:
|
|
>
Quote:
Quote:
|
Return Date, Extension Time for Return Date
|
|
>
Quote:
Quote:
|
i need a query to choose the max date between these two fields
|
|
>
Quote:
Quote:
eg: if return date * * * = 01 May 2008
* * * * ext return date = 10 may 2008
|
|
>
Quote:
Quote:
|
then the query should choose 10 may 2008
|
|
>>>
Quote:
|
MaxDate = -(Date1 Date2) * Date1 - (Date2 Date1) * Date2- Hide quoted text -
|
>
- Show quoted text -
|
hi all,
thank you all for trying to help me
actually i found the solution on microsoft website
they have designed on function called maximum and another one called
minimum
and that is what i was looking for
here is the link
http://support.microsoft.com/kb/209857
and here is the code
Function Minimum(ParamArray FieldArray() As Variant)
' Declare the two local variables.
Dim I As Integer
Dim currentVal As Variant
' Set the variable currentVal equal to the array of values.
currentVal = FieldArray(0)
' Cycle through each value from the row to find the smallest.
For I = 0 To UBound(FieldArray)
If FieldArray(I) < currentVal Then
currentVal = FieldArray(I)
End If
Next I
' Return the minimum value found.
Minimum = currentVal
End Function
Function Maximum(ParamArray FieldArray() As Variant)
' Declare the two local variables.
Dim I As Integer
Dim currentVal As Variant
' Set the variable currentVal equal to the array of values.
currentVal = FieldArray(0)
' Cycle through each value from the row to find the largest.
For I = 0 To UBound(FieldArray)
If FieldArray(I) currentVal Then
currentVal = FieldArray(I)
End If
Next I
' Return the maximum value found.
Maximum = currentVal
End Function
thanks all