I thought this would be simple but it's confounding me so I find myself coming here to ask you geniuses how to do this.
Using MS Access 365, I'm trying to have VBA tell me the date of next Sunday. I've been using this:
But it breaks down if I run it on Saturday, picking the *following* Sunday rather than tomorrow.
Once that's fixed, I would like to be able to have the code tell me the date of each successive Sunday based on what the user enters. So let's say I'm running the code on 2021-05-22, Saturday. If I enter a '1', it gives me 2021-05-23. If I enter a '2', it'll tell me 2021-05-30. If I enter a '3', it'll tell me 2021-06-06, and so on.
Thanks!!
Matt
Using MS Access 365, I'm trying to have VBA tell me the date of next Sunday. I've been using this:
Code:
Format(Now() + 9 - Weekday(Now() + 1, vbSunday), "yyyy-mm-dd")
But it breaks down if I run it on Saturday, picking the *following* Sunday rather than tomorrow.
Once that's fixed, I would like to be able to have the code tell me the date of each successive Sunday based on what the user enters. So let's say I'm running the code on 2021-05-22, Saturday. If I enter a '1', it gives me 2021-05-23. If I enter a '2', it'll tell me 2021-05-30. If I enter a '3', it'll tell me 2021-06-06, and so on.
Thanks!!
Matt