Welcome to 16892 Developer Community-Open, Learning,Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In my database, I have a field with the following calculation:

AD logon date: IIf([lastLogonDate]>[LLTConverted],[lastLogonDate],[LLTConverted])

I filter it using the following criteria:

<Date()-60

However, when I run the query, it displays dates that are in the last 60 days.

In the source file, lastLogonDate and LLTConverted are set to Short Date format. I tried setting the AD logon date field's format manually (via Properties) to Short Date. I also tried to use the following code:

AD logon date: Format(IIf([lastLogonDate]>[LLTConverted],[lastLogonDate],[LLTConverted]),"dd/mm/yyyy")

Furthermore, in the Properties sheet, I set the Data Type to Date with Time. Neither of them worked.

Is there another approach I could use?

EDIT:

Data before filter:

08/01/2021
30/09/2020
24/06/2020
17/06/2020
20/05/2020
17/06/2020
28/02/2020
07/01/2021
10/09/2020
13/11/2019
07/01/2021
01/06/2020
21/05/2020
25/05/2020
08/01/2021
07/01/2021
07/08/2020
18/02/2020
28/02/2020
25/06/2020
07/10/2020
01/04/2019
07/02/2020
28/11/2019
28/10/2020
18/02/2020
07/10/2020

After filter:

08/01/2021
07/01/2021
10/09/2020
07/01/2021
01/06/2020
08/01/2021
07/01/2021
07/08/2020
07/10/2020
01/04/2019
07/02/2020
07/10/2020


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
289 views
Welcome To Ask or Share your Answers For Others

1 Answer

You are mixing up things. DateTime values carry no format, only a value.

Thus, if fields [lastLogonDate] and [LLTConverted] are true DateTime, filtering with Date()-60 cannot fail.

If it does, your fields are most likely Short Text, and must have a proper format like yyyy-mm-dd, and they must be converted before comparison:

AD logon date: DateValue(IIf(DateValue([lastLogonDate]) > DateValue([LLTConverted]), [lastLogonDate], [LLTConverted]))

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to 16892 Developer Community-Open, Learning and Share
...