I need to generate a query where I've a requirement to show all employees who have their training validity expired once we compare the Completion Date field in one table with ValidityYears (validation on certificate in years) of training in another table.
Attaching relationship screenshot, when I try to use DateDiff function in expression builder as:
IIf((DateDiff("yyyy",[tblEmployeeTrainings]![CompletionDate],Date())>=[tblWorkTrainings]![ValidityYears]),1,0)
It gives correct result when it compare to years, but it can't compare months and days. for example completion date of certificate was at April 30, 2014. If it compare it with current date it should show me false part of IIf because it still has over a month left in expiry from now, but it shows me true because query is comparing only years. I've spent several hours but could not figure out.
How should i rewrite the query in expression builder so that i compare to the months and days level PLEASE?
Thanks.
Attaching relationship screenshot, when I try to use DateDiff function in expression builder as:
IIf((DateDiff("yyyy",[tblEmployeeTrainings]![CompletionDate],Date())>=[tblWorkTrainings]![ValidityYears]),1,0)
It gives correct result when it compare to years, but it can't compare months and days. for example completion date of certificate was at April 30, 2014. If it compare it with current date it should show me false part of IIf because it still has over a month left in expiry from now, but it shows me true because query is comparing only years. I've spent several hours but could not figure out.
How should i rewrite the query in expression builder so that i compare to the months and days level PLEASE?
Thanks.