Iff statement - current or expired contracts

C

Chey

I have a query and I am trying to add this columm to analyse if the contract
is current or expired.

Somehow does not work. Please help

Expr1: IIf([CONTRACT END DATE]="Cont." OR [CONTRACT END
DATE]>Now(),"Current","Expired")
 
D

Dennis

Have n't tested it but try this
Expr1: IIf([CONTRACT END DATE]="Cont." OR CDate([CONTRACT END
DATE])>Now(),"Current","Expired")
 
J

John Spencer

The problem is that your field is NOT a DateTime field, but is a text
field. PERHAPS the following UNTESTED expression will work for you.

IIF(IsDate([Contract End Date]),
IIF(DateValue([Contract End Date]) > Date(),"Current","Expired"),
IIF([Contract End Date] = "Cont.","Current","Expired"))

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
C

Chey

Very true. Actually I tried to turn this into a datetime field but was not
able to...
Thank you very much!!! That solved my problem.

John Spencer said:
The problem is that your field is NOT a DateTime field, but is a text
field. PERHAPS the following UNTESTED expression will work for you.

IIF(IsDate([Contract End Date]),
IIF(DateValue([Contract End Date]) > Date(),"Current","Expired"),
IIF([Contract End Date] = "Cont.","Current","Expired"))

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================

I have a query and I am trying to add this columm to analyse if the contract
is current or expired.

Somehow does not work. Please help

Expr1: IIf([CONTRACT END DATE]="Cont." OR [CONTRACT END
DATE]>Now(),"Current","Expired")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top