I have an SQL statement that returns the week number using the DatePart function. Is their a way I can get the friday date of the week number it returns to me ?
Thanks in advance for any help !!
Printable View
I have an SQL statement that returns the week number using the DatePart function. Is their a way I can get the friday date of the week number it returns to me ?
Thanks in advance for any help !!
well.. it isnt pretty.. but it works
VB Code:
Dim DTE As Date Dim tmp As Integer tmp = WEEK_NUM_FROM_SQL DTE = CDate("1/1/" & Year(Date)) 'set to the first day of this year Do Until Format(DTE, "ww") = tmp 'loop till it hits the week returned DTE = DateAdd("d", 1, DTE) Loop Do Until Weekday(DTE) = vbFriday 'find the friday DTE = DateAdd("d", 1, DTE) Loop MsgBox DTE
Substitute the date for NOW. Weekday() returns an integer.
VB Code:
Option Explicit Private Sub Form_Load() MsgBox WeekdayName(Weekday(Now)) End Sub
dave, he needs to find the Friday of the week number returned...
like currently its week # 39.. so he would need it to return 9/23/05
(At least thats how I understood it)