Search code examples
sqlms-access

can you add an extra parameter to DateAdd function?


i'm using dateadd to sum 2 fields in my access query, but i want to always add "1" year to the result of the dateadd.

Example:

Dateadd('yyyy', [field1],[field2]) + 1

it's not working. It's only giving me the sum of Dateadd('yyyy', [field1],[field2])

Field1 = date
Field2 = number

example:

field1 = 2020-01-01

field2 = 2

i want 2020-01-01 + 2 + 1(I always want to add 1 year at the end)

I should get 2023-01-01


Solution

  • I think what you want is:

    DATEADD(‘yyyy’, ([field2]+1), [field1])