MiniMe
03-08-2004, 09:03 AM
Hiya,
I have a control array and above the control array, I have 7 labels, one for each day of the week. I've also got a DTPicker1 control which is selected by the user. Ignoring the commented bits of code, the code below produces the following:
'FindDate = Format(CurDate, "d", vbMonday) 'Find current Date
'FindWeekday = Format(CurDate, "w", vbMonday) 'Find day of week no. (1-7)
'FindMonday = FindDate - (FindWeekday - 1) 'Subtract to find Monday
For NoDays = 0 To 6
lblDay(NoDays) = Format(NoDays + 2, "dddd", vbMonday) + " " + Str$(frmEntry.DTPicker1 + NoDays) 'Puts day/date at top of each column
Next NoDays
Supposing the user selects the date: 18/02/04 the following is displayed.
Monday ; Tuesday ; Wednesday ; Thursday ; Friday ; Saturday ; Sunday
18/02/04; 19/02/04 ; 20/02/04 ; 21/02/04 ; 22/02/04 ; 23/02/04 ; 24/02/04
However, 18/02/04 is not a Monday and also when I click through the other MonthView dates, they same the same. Before implementing the DatePicker function I had the following and this worked fine. Is there any way to combine the two so that this works?
FindDate = Format(CurDate, "d", vbMonday) 'Find current Date
FindWeekday = Format(CurDate, "w", vbMonday) 'Find day of week no. (1-7)
FindMonday = FindDate - (FindWeekday - 1) 'Subtract to find Monday
For NoDays = 0 To 6
lblDay(NoDays) = Format(NoDays + 2, "dddd", vbMonday) + " " + Str$(FindMonday+ NoDays) 'Puts day/date at top of each column
Next NoDays
Thanks,
MiniMe
I have a control array and above the control array, I have 7 labels, one for each day of the week. I've also got a DTPicker1 control which is selected by the user. Ignoring the commented bits of code, the code below produces the following:
'FindDate = Format(CurDate, "d", vbMonday) 'Find current Date
'FindWeekday = Format(CurDate, "w", vbMonday) 'Find day of week no. (1-7)
'FindMonday = FindDate - (FindWeekday - 1) 'Subtract to find Monday
For NoDays = 0 To 6
lblDay(NoDays) = Format(NoDays + 2, "dddd", vbMonday) + " " + Str$(frmEntry.DTPicker1 + NoDays) 'Puts day/date at top of each column
Next NoDays
Supposing the user selects the date: 18/02/04 the following is displayed.
Monday ; Tuesday ; Wednesday ; Thursday ; Friday ; Saturday ; Sunday
18/02/04; 19/02/04 ; 20/02/04 ; 21/02/04 ; 22/02/04 ; 23/02/04 ; 24/02/04
However, 18/02/04 is not a Monday and also when I click through the other MonthView dates, they same the same. Before implementing the DatePicker function I had the following and this worked fine. Is there any way to combine the two so that this works?
FindDate = Format(CurDate, "d", vbMonday) 'Find current Date
FindWeekday = Format(CurDate, "w", vbMonday) 'Find day of week no. (1-7)
FindMonday = FindDate - (FindWeekday - 1) 'Subtract to find Monday
For NoDays = 0 To 6
lblDay(NoDays) = Format(NoDays + 2, "dddd", vbMonday) + " " + Str$(FindMonday+ NoDays) 'Puts day/date at top of each column
Next NoDays
Thanks,
MiniMe