Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing 2 Date Fields with Possible Nulls

Status
Not open for further replies.

sardine53

Programmer
Jul 4, 2003
79
US
Hello,

Using Access 2007

I need to have a query than returns the greater of 2 dates. This works if only if there are no nulls/blanks:

MaxOfAAndB: IIF([DATE_A]>[DATE_B],[DATE_A],[DATE_B])

Can I use a NZ function with this query? If so, how? If not, what should I use?

(I know I can use function but I would rather use a query.)

Thanks in advance!
 
Like this ?
MaxOfAAndB: IIF(Nz(DATE_A,0)>Nz(DATE_B,0),DATE_A,DATE_B)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top