Access Question. Date Formula in a Query in the Field

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
1,756
Office Version
  1. 365
Platform
  1. Windows
Expr1: DateDiff("d",[PDIR Due Date],Now())

I put this formula in my query and it works. But I would like to change it to an Iff statement where it only does this formula if [PDIR Completed] is blank.

Can I do that?
 
Last edited:

Some videos you may like

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
1,756
Office Version
  1. 365
Platform
  1. Windows
Days_Late: IIf([PDIR Completed] Is Null,DateDiff("d",[PDIR Due Date],Now()),"")
 

xenou

MrExcel MVP
Joined
Mar 2, 2007
Messages
16,706
Office Version
  1. 2019
Platform
  1. Windows
THis looks a little iffy because datediff returns a long integer but your "else" condition returns a string. Might work for reports, query results only but be careful if this data has to be used or saved in a table (the mixed up data types could cause problems).
 

Watch MrExcel Video

Forum statistics

Threads
1,113,890
Messages
5,544,879
Members
410,643
Latest member
sng
Top