Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding all days related to Datepart "WW"

Status
Not open for further replies.

sjdk

Programmer
May 2, 2003
59
0
0
US
I have an active x calendar on my form. I also have 2 text boxes, one called InputDate, which displays the date selected in the calendar. The other is called Week, with the control source being: =DatePart("WW", [InputDate]) This returns the week number for the date selected. So far, life is good. Now, what I want to do is populate 7 other text boxes (named Mon, Tue, Wed etc.) with the 7 days included in the week selected. For example, if I choose Feb 7, 2006 on the calendar, InputDate displays 02/07/06, and Week displays 6. In the Mon text box, I want 02/06/06 to appear. In the Tue textbox, I want 02/07/06 to appear and so on. How do I do this?

Thanks in advance!
Steph
 
You could try using the Day Number value in the getdate() function, just provide it with a valid timestamp and it will return from 0 to 6 where 0 = Sunday and 6 = Saturday.

Ahdkaw
 
NEVER MIND!! I figured it out!

What I did was in each of the 7 textboxes I set the control source to =[InputDate]-Weekday([InputDate])+2 (for Monday), +3 for Tuesday and so on. IT works great!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top