Greater of 2 Dates ?

lucour

Registered User.
Local time
Today, 00:34
Joined
Mar 7, 2001
Messages
60
Hi,

I have a query setup, using a caculated field, to determine the greater of 2 dates, from 2 separate fields. Here is my calculated field:

LastContactDecide: IIf([Date1_Last_Contacted]>[Date2_Last_Contacted],[Date1_Last_Contacted],[Date2_Last_Contacted])


This works fine, except when there is a null value in either Date1_Last_Contacted or Date2_Last_Contacted. How do I get around this ?

Thanks !
 
When you're setting the values of [Date1_Last_Contacted] and [Date1_Last_Contacted] make sure they don't get set to null. You could use a default value, wherever this is the case.

For example, if the values were being pulled from a form:

current
[Date1_Last_Contacted] = [Form1].[Field1]

new
[Date1_Last_Contacted] =IIF(IsNull([Form1].[Field1]),{default value},([Form1].[Field1])

Any use?
 

Users who are viewing this thread

Back
Top Bottom