Getting previous week's date range

How would I write a function that returns the previous week's date range?  For instance, if the run date is Monday 3/18/2002, it'll return "3/10/2002 - 3/16/2002."
arichexpAsked:
Who is Participating?
 
bill02Connect With a Mentor Commented:
label1.caption = DateAdd("d", -7, Now) - DateAdd("d", 7, Now)
0
 
BahnassCommented:
TRY THIS
DEBUG.PRINT  (DATE - WEEKday(date)),(DATE - WEEKday(date)-7)
0
 
bill02Commented:
label1.caption = DateAdd("d", -7, Format(Now, "mm/dd/yyyy")) & " - " &  DateAdd("d", 7, Format(Now, "mm/dd/yyyy"))

sorry
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
arichexpAuthor Commented:
But what if the run date is any day of the week, not just Monday?
0
 
bill02Commented:
this should do what you need replace now with your dates and format them ass you  wish



Label1.Caption = DateAdd("d", (-(Weekday(Now) - 1)), Now) & " - " & DateAdd("d", (7 - (Weekday(Now))), Now)
0
 
bill02Commented:
im sooooooo sorry i did not mean ass i as sorry
0
 
BahnassCommented:
Did U C MY POST


DEBUG.PRINT  (DATE - WEEKday(date)),(DATE - WEEKday(date)-7)

1     Date     returns current date
2     WeekDay returns a number of day in week  

So please try it

pls give feedback  ( if U need to reject Bill answer U can do it simply )

0
 
arichexpAuthor Commented:
Thanks, although I modified it slightly for a datetime field, i.e.

date_beg = Date - Weekday(Date) - 6 & " 00:00:00"
date_end = Date - Weekday(Date) & " 23:59:59"
0
 
arichexpAuthor Commented:
Thanks Bahnass!
0
 
BahnassCommented:
arichexp

Where is my Points !!!!!

WeekDay from beginning !!!!!
0
 
arichexpAuthor Commented:
For some reason, the points went to bill02, even though I accepted your comment as the answer.  Is there a bug of somekind?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.