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

Specific Dates - Next Monday

P: 50
Hi there, i hope someone can help me ASAP please.

I want to show 2 text boxes on a form which indicate next weeks starting date (next monday) and the week afters.

ie today is 14/12/2007 - i need 'textbox1' to automatically show "Mon 17/12/07" and 'textbox2' to automatically show "Mon 24/12/2007".

I'd appreciate anyones help on this one, thanks in advance, OllyJ
Dec 14 '07 #1
Share this Question
Share on Google+
6 Replies


lee123
100+
P: 556
hello you could default this by using this:

Expand|Select|Wrap|Line Numbers
  1. date()  for textbox 1 and :
  2. date()+10  in textbox 2
put these in the default value of the textboxes

lee123
Dec 14 '07 #2

FishVal
Expert 2.5K+
P: 2,653
Something like the following:

Expand|Select|Wrap|Line Numbers
  1. DateAdd("d", 8 - Weekday(Date, vbMonday), Date)
  2. DateAdd("d", 15 - Weekday(Date, vbMonday), Date)
  3.  
Regards,
Fish
Dec 14 '07 #3

P: 50
Thank you for your help.

Fish, your code helped tremendously.

The final code I used for "next Monday" and "the Monday after" (as it may help someone else out) is.....

"Next Monday": =DateAdd("d",8-Weekday(Date(),2),Date())

"the Monday after": =DateAdd("d",15-Weekday(Date(),2),Date())

Thanks again, OllyJ
Dec 14 '07 #4

FishVal
Expert 2.5K+
P: 2,653
Glad it has helped you.

Best regards,
Fish
Dec 14 '07 #5

NeoPa
Expert Mod 15k+
P: 31,660
Something like the following:

Expand|Select|Wrap|Line Numbers
  1. DateAdd("d", 8 - Weekday(Date, vbMonday), Date)
  2. DateAdd("d", 15 - Weekday(Date, vbMonday), Date)
  3.  
Regards,
Fish
A perfect answer Fish ;)
Dec 14 '07 #6

FishVal
Expert 2.5K+
P: 2,653
Thanks, NeoPa.
I just like such kind of solutions with "arithmetical" logic. ;)
Dec 14 '07 #7

Post your reply

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