Solved DateAdd (1 Viewer)

Brsln

New member
Local time
Today, 14:21
Joined
Dec 2, 2022
Messages
2
I have a Dateadd function in a query, which is supposed to give me 1 month + 7days after whatever end of month date is in another text box
The query is VATDueDate: (DateAdd("m",1,[VAT Date]))+7.
However, if the month is a 31 day one I get the 7th and 30 day one I get the 6th.
I should get the 7th regardless.
Would you know where I am going wrong? for example if the end of month date is 2022/11/30 then it returns 2023/01/06 but I expect 7th.
Thanks.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:21
Joined
May 7, 2009
Messages
19,245
you can try:

VatDueDate: DateSerial(Year([VAT DATE]), Month([VAT DATE]) + 1, 7)
 

Brsln

New member
Local time
Today, 14:21
Joined
Dec 2, 2022
Messages
2
Thanks very much arnelgp. I had to change +1 to +2 as +1 was showing the following month. a month + 7 days should show 2 months after the current month.
For example, VAT Date: 30/11/2022 VatDueDate: DateSerial(Year([VAT DATE]), Month([VAT DATE]) + 1, 7) gave me 07/12/2022, which is wrong. Changing it to VatDueDate: DateSerial(Year([VAT DATE]), Month([VAT DATE]) + 2, 7) gave me the correct result, which is 07/01/2023.
Thanks a lot.
 

Users who are viewing this thread

Top Bottom