Determine the date for the Friday of a given Year and week Number

  • Thread starter Thread starter \DoctorV3774 via AccessMonster.com\
  • Start date Start date
D

\DoctorV3774 via AccessMonster.com\

If on my report I have the Year in field Txt_Year and I have the Week Number
in field Txt_Week, what function can i use to determine the datae for Friday.

Example Txt_Year returns 2005
Txt_Week returns 20
I need a text box named Txt_Date to return 5/13/2005 which is the
corresponding Friday for those Year and week Number Parameters. How can i do
this? Thanks
 
DoctorV3774 via AccessMonster.com said:
If on my report I have the Year in field Txt_Year and I have the Week
Number in field Txt_Week, what function can i use to determine the
datae for Friday.

Example Txt_Year returns 2005
Txt_Week returns 20
I need a text box named Txt_Date to return 5/13/2005 which is the
corresponding Friday for those Year and week Number Parameters. How
can i do this? Thanks

weekday(yourweek, vbfriday)


--
_ _
Ciao
MAssimiliano Amendola www.accessgroup.it
Cisa - Conferenza Italiana per Sviluppatori Access
Info: www.donkarl.com/it
 
You can use a formula using DateAdd, Weekday, and DateSerial functions.

Perhaps the following would work. UNTESTED (and all on one line, the newsreader
will probably wrap this onto multiple lines)

DateAdd("ww",Val(txtWeek)-1,DateSerial(Val(Txt_Year),1,1))- Weekday(DateAdd("ww",Val(txtWeek)-1,DateSerial(Val(Txt_Year),1,1)))+6
 
Back
Top