Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 505
  • Last Modified:

DTPicker - How to determine the day of the week?

Hi Experts

I’m generating a weekly report every Monday (usually, except when a holiday lands on the Monday). The From/To dates would range from the Monday to Sunday of the previous week.

In our old system, the user would have to enter the From/To dates each time the report was generated. I would like to have these dates pre-populated in my Access form using Microsoft’s Date Time Picker (DTPicker).

The logic would be if today is Monday (August 30) then
From Date =  2004-08-23  
To Date = 2004-08-29

The same would apply if the report was generated on Tuesday (August 31) which would be the case if Monday was a holiday. The results would be the same.
From Date =  2004-08-23  
To Date = 2004-08-29

I know that I can subtract days from the DTPicker value
Example:
If DTPicker.Value = today’s date  (Monday, August 30)
then
DTPicker1. Value = DTPicker1.value – 7
If today was Tuesday I would subtract 8 from the value, etc. to get the FROM date

The problem I’m having is that I can’t identify if today is a Monday, Tuesday, etc…

Any thoughts would be appreciated.
0
JakeB52
Asked:
JakeB52
  • 3
1 Solution
 
bkthompson2112Commented:
Hi JakeB52,

You can use the Weekday function.  Like this:

Select Case Weekday(Now)
  Case vbSunday
  Case vbMonday
  .
  .
  .
End Select

bkt
0
 
bkthompson2112Commented:
0
 
DarkoLordCommented:
Try this:
MsgBox Format$(DtPicker1.Value, "dddd")

Darko
0
 
JakeB52Author Commented:
Thanks Everyone!

All your answers were helpful but bkthompson2112 was first off the block.
0
 
bkthompson2112Commented:
Thanks for the 'A' : )
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.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now