0

How to highlight a week if the week number is given. e.g. against week number 22, the form must show the dates ranging between 2/july/08 to 9/july/08.

Thanx in advance :)

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by selvaganapathy
0

Hi,
You can use DateAdd () Function

Syntax
DateAdd ( Interval As String, Number As Double, DateValue As Date ) As Date

Parameters
Interval - String expression representing the time interval you want to add
Give interval as "ww" for week
Number - Floating-point expression representing the number of intervals you want to add
Date - An expression representing the date and time to which the interval is to be added

Example

Dim DateRangeFrom As Date
   Dim DateRangeTo As Date
   Dim WeekOfTheYear As Integer
   
   WeekOfTheYear = 22
   
   DateRangeFrom = DateAdd("ww", WeekOfTheYear - 1, CDate("1/1/2008"))
   DateRangeTo = DateRangeFrom + 7
   MsgBox " From " & DateRangeFrom & " To " & DateRangeTo
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.