By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,335 Members | 2,313 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,335 IT Pros & Developers. It's quick & easy.

return the date of this coming sunday

P: 15

I would like to obtain the date of this coming sunday, without having to code in sql (im a bit of an access newbie)

im assuming using syntax such as now() weeknum() or format$() can somehow be put together to obtain what im looking for.

plz help, thanks in advance
Nov 12 '06 #1
Share this Question
Share on Google+
3 Replies

P: 15
Ok: I have got to this point:

an IFF statement embedded 6 times for every day of the week, determines how many days to add to now() to obtain the date of Sunday like such:

=IIf(Weekday(Now())=1,"set date accordingly here",IIf(Weekday(Now())=2,"set date accordingly here","etc from here"))

What i need to know is how do you add X amount of days to a date [now()], obviously without ending up with a date like 32 of January (which would obviously be 1st of Febuary, as required )

Nov 12 '06 #2

Expert Mod 15k+
P: 31,494
You can use
Expand|Select|Wrap|Line Numbers
  1. Date()+8-WeekDay(Date())
Nov 12 '06 #3

P: 15
Well the complete funtion now looks like this:

Expand|Select|Wrap|Line Numbers
  1. =IIf(Weekday(Now())=1,DateAdd("d",7,Now()),
  2. IIf(Weekday(Now())=2,DateAdd("d",6,Now()),
  3. IIf(Weekday(Now())=3,DateAdd("d",5,Now()),
  4. IIf(Weekday(Now())=4,DateAdd("d",4,Now()),
  5. IIf(Weekday(Now())=5,DateAdd("d",3,Now()),
  6. IIf(Weekday(Now())=6,DateAdd("d",2,Now()), 
  7. IIf(Weekday(Now())=6,DateAdd("d",1,Now()) )))))))
Haven't actually tested it yet for everyday, but should do.
Ta NeoPa
Nov 13 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.