Search code examples
ms-accessexpressiondateadd

Access expression, add one year, minus a day


I have a table in access, which has a contract start date, contract end date.

It also needs auto filled columns for the start and end date of each year between the contract start and end dates.

E.g, customer takes out 5 year contract.

01/01/2020 - 01/01/2025

Year 1’s end date would be 1 year, minus a day from the contract start date:

31/12/2020.

As mentioned, this needs to be written as an expression in Microsoft Access.

I can’t find info on multiple date calculations from a singular start date (DateAdd etc).

Thanks for any help


Solution

  • Use DateAdd in code (or query):

    UltimoYear = DateAdd("d", -1, DateAdd("yyyy", 5, DateStart))
    

    Replace 5 with 1 for one year.