Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding First Monday of the week 2

Status
Not open for further replies.

dixxy12

Technical User
Jun 18, 2007
45
CA
Hi,

I am having trouble finding something...i have searched the forum, looked in the help files of both vb and Access and did not get this to work.

I would like to show the first monday of the week and then the friday in another field.

Basically showing something like this:

'Week of the 9 June to 13 June 2008'

I can i achieve this on a report?

Thanks
 
The first Monday? ... there's more than one?

Presumably you have some date that is in the week that you want to display. Let's assume that that date is in the field myDate.

Monday (the first and only) is then
Code:
Dateadd ("d", 2-weekday(myDate), myDate)

and Friday is
Code:
Dateadd ("d", 6-weekday(myDate), myDate)
 
Yep...that does it perfectly...i new it had to be easy....

thanks for pointing me in the right dirrection
 
Hi dixxy12
A great way to thank someone is to click:

Thank Golom
for this valuable post!
 
How are ya dixxy12 . . .

Agree with Remou.

Do take the time to go over one of the links at the bottom of my post. The links will help you ask better questions and gives insite into etiquette here in the forms.

Although you've been a member since Jun 18, 2007 . . .

Welcome to [blue]Tek-Tips![/blue] [thumbsup2]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
not that I LIKE to beat the horses, but using the 'intrincic' constants for the day of the week in Golems' expressions above would improve the 'documentation' / readability of the code (for future /newbies AND senior citizens. e.g.

Code:
Dateadd ("d", vbMonday-weekday(myDate), myDate)

and Friday is

Code:
Dateadd ("d", vbFriday-weekday(myDate), myDate)




MichaelRed


 
Another way:
"Week of the " & (myDate - Weekday(myDate, vbMonday) + 1) & " to " & (myDate + 8 - Weekday(myDate, vbFriday))

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top