0
votes

I would like to add a column to my datasheet that uses a date expired field and today's date in a formula and then display if it is active, pending expiration, or expired. Here is what I have tried and Access:

IIf([Date Expired]-Date()>60,"Active",IIf([Date Expired]-Date() < 60 AND [Date Expired]-Date() => 0,"Pending Expiration","Expired"))

I start by going to the Design View of the datasheet. By going to the first open row at the bottom and selecting Calculation from the menu options in the second column, it brings up the expression builder.

When I try to enter the formula like the one above into the access expression builder window, it says I cannot enter a formula like that in a calculated column.

How can a get a column to display the results of a formula like this?

1

1 Answers

0
votes

You can't use the word AND you need the function AND(test1,test2)

 IIf([Date Expired]-Date()>60,"Active",IIf(AND([Date Expired]-Date() < 60 , [Date Expired]-Date() >= 0),"Pending Expiration","Expired"))