Solved

Showing a date range

Posted on 2013-11-25
3
163 Views
Last Modified: 2013-11-25
I would like to be able to display the dates from Monday to Friday of a particular week on a report using the system date (which will be a date that falls during that particular week, between Mon to Friday). For example, if the system date is 11/27/2013, it will show: 11/25/13 - 11/29/13. If the date is 11/26/13, it will still show: 11/25/13 - 11/29/13. If the date is 12/5, it will show: 12/2-12/6.

Is there anyway I could accomplish this?
0
Comment
Question by:geeta_m9
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 250 total points
ID: 39675178
<Is there anyway I could accomplish this? >

yes, but you need to create a user define function in vba

sample

Function GetWeekDate(d As Date)  
Dim monDate As Date
monDate = d + 1 - Weekday(d, 2)
GetWeekDate = monDate & "-" & DateAdd("d", 4, monDate)
End Function
0
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 250 total points
ID: 39675623
to get the date of the Monday of the current week (Mon-Fri), use:

?dateadd("d", weekday(date(), vbMonday) -1, date())

To get the Friday of the same week, use:

?dateadd("d", 5-weekday(date(), vbMonday), date())
0
 

Author Closing Comment

by:geeta_m9
ID: 39675840
Both the solutions work well, thanks.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question