Kirk,
No, week() is not much of a help (at all <g>). We had to write several
small functions for stuff like this ourself.
I would try to get the date of the first day of the week You want to show
In Germany the week starts with Monday. So we wrote a function GetMonday()
that returns the monday's date any given date (it's from the days where
dow() did not have the optional parameter for the first day of the week)
This.n_WeekStart in this is 2 (Monday)
PROCEDURE GetMonday
lparameters td_Date
LOCAL ln_Tag, ld_RetVal
do case
case vartype(td_Date) = "D"
case vartype(td_Date) = "T"
td_Date = ttod(td_Date)
other
td_Date = date()
endcase
ln_Tag = dow(td_Date)
if ln_Tag < this.n_WeekStart
ln_Tag = ln_Tag + 7
endif
return td_Date - ln_Tag + this.n_WeekStart
ENDPROC
so GetMonday({^2002-05-17}) will return {^2002-05-13}. If You have this date
as ld_WeekStart the selected date will be ld_Start + .optiongroup.Value -1.
Now simply check this date against your reference-Date (17th). If it is
smaller than that, add a week (7) and You're set.
Lets say the first day is monday (You'll need to tweak that for Your Sunday
being the first day of the week) and You call the form with today's date
then clicking on the "Tuesday" will make a date {^2002-05-13}+2-1 =
{^2002-05-14}. This is smaller than the reference-Date (today) so add
7 => {^2002-05-21}
HTH
Regards form Berlin
Frank
>VFP7- Application does appointment scheduling. I have a form that gets called to make recurring appointments. It gets passed a datetime field of an initial appointment. Lets say it gets passed 05/17/2002 07:00 which is a friday. The user can select the day of week to create the recurring appointments on, using an optiongroup with Monday-Friday. So for this example, they want the first recurring appointment start on the next tuesday after the 17th which would be the 21st . So they click the Tueday option. So now in my code I need to figure out how to set my start date to 05/21/2002. I thought I could use the week() function, but that hasn't been any help.