sqlms-accessiifiif-function

MS Access IIF Query if Date


I'm trying to create an access query based on the date field, the query i Have which runs but doesn't populate the correct information is as follows

IIf([Last Pyt Date]>DateAdd("d",-60,Date()),'Arrangement in place'))

the "Last Pyt Date" needs to be within the last 60 days to populate "Arrangement in place" otherwise I will specify different information to populate if the day of Last Pyt is older than 60 days.


Solution

  • You likely want to reverse your logic to match your description

    IIf( Date() < DateAdd("d", 60, [Last Pyt Date]), 'Arrangement in place')