Solved

# DTPicker -  How to determine the day of the week?

Posted on 2004-09-03
459 Views
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
Question by:JakeB52
• 3

LVL 6

Accepted Solution

bkthompson2112 earned 125 total points
ID: 11972231
Hi JakeB52,

You can use the Weekday function.  Like this:

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

bkt
0

LVL 6

Expert Comment

ID: 11972238
0

LVL 22

Expert Comment

ID: 11972251
Try this:
MsgBox Format\$(DtPicker1.Value, "dddd")

Darko
0

Author Comment

ID: 11972441
Thanks Everyone!

0

LVL 6

Expert Comment

ID: 11972546
Thanks for the 'A' : )
0

## Featured Post

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…